#pragma once

#include "utility.h"
#include <cstddef>
#include <tuple>
#include <vector>

#include <Entities/Components.h>
#include <Entities/Entity.h>

using ComponentVectorTuple = std::tuple
<
	std::vector<Transform>,
	std::vector<Texture>,
	std::vector<BoundingBox>
>;

class EntityMemoryPool
{
private:
	ComponentVectorTuple m_components;
	std::vector<EntityTag> m_tags;
	std::vector<bool> m_aliveStates;
	std::vector<size_t> m_ids;
	
private:
	EntityMemoryPool();

	EntityMemoryPool(const EntityMemoryPool&) = delete;

public:
	static EntityMemoryPool& instance();

	template<typename T>
	bool hasComponent(EntityIndex) const;
	
	template<typename T>
	T& getComponent(EntityIndex) const;

	template<typename T>
	T& getComponent(EntityIndex);

	EntityTag getTag(EntityIndex) const;

	bool getAlive(EntityIndex) const;

	size_t getId(EntityIndex) const;

	void removeEntity(EntityIndex);
};