#pragma once

#include <utility.h>

class EntityManager;
class EntityMemoryPool;

class Entity;

class EntityView
{
private:
	friend class EntityManager;
	friend class EntityMemoryPool;

	EntityView() = delete;
	EntityView(EntityMemoryPool&, index_t, index_t);
public:
	class iterator
	{
	public:
		iterator(EntityMemoryPool&, index_t);
		iterator& operator++();
		iterator operator++(int);
		iterator& operator--();
		iterator operator--(int);
		Entity operator*();
		Entity operator[](int);
		bool operator==(iterator);
		bool operator!=(iterator);
	private:
		EntityMemoryPool& m_data;
		index_t m_currentEntity{};
	};

	Entity operator[](index_t) const;

	iterator begin();
	iterator end();

private:
	EntityMemoryPool& m_data;
	index_t m_start{};
	index_t m_size{};
};