#ifndef id0ADBCC15BA574485BF3267254090D99B
#define id0ADBCC15BA574485BF3267254090D99B

#include "doorkeeper/primitivetypes.hpp"
#include "doorkeeper/components/tileiterator.hpp"
#include "doorkeeper/components/layer.hpp"
#include <cstdint>

namespace dk {
	template <uint32_t D>
	class Tyler;

	template <typename T, uint32_t D>
	class Layer;

	template <uint32_t D>
	class Viewport {
	public:
		typedef Vector<D> coords;

		Viewport ( const Viewport& parOther ) = default;
		explicit Viewport ( Tyler<D>& parTyler );
		Viewport ( Tyler<D>& parTyler, const coords& parSize, const coords& parPos );
		~Viewport ( void ) noexcept = default;

		Viewport& operator= ( const Viewport& ) = default;

		void setSize ( const coords& parSize );
		void setFrom ( const coords& parFrom );
		void setFromSize ( const coords& parFrom, const coords& parSize );
		const coords& count ( void ) const { return m_size; }

		template <typename T>
		typename Layer<T, D>::iterator begin ( Layer<T, D>& parLayer ) const;
		template <typename T>
		typename Layer<T, D>::iterator end ( Layer<T, D>& parLayer ) const;
		template <typename T> inline
		typename Layer<T, D>::const_iterator begin ( const Layer<T, D>& parLayer ) const a_always_inline;
		template <typename T> inline
		typename Layer<T, D>::const_iterator end ( const Layer<T, D>& parLayer ) const a_always_inline;
		template <typename T>
		typename Layer<T, D>::const_iterator cbegin ( const Layer<T, D>& parLayer ) const;
		template <typename T>
		typename Layer<T, D>::const_iterator cend ( const Layer<T, D>& parLayer ) const;

	private:
		coords m_size;
		coords m_position;
		Tyler<D>& m_tyler;
	};
} //namespace dk

#include "doorkeeper/implem/viewport.inl"

#endif
