#include <EntityRegistry/EntityRegistry.hpp>
#include <Entity/PhysicsEntity/CameraEntity/Player/Player.hpp>
#include <Entity/PhysicsEntity/ItemEntity/ItemEntity.hpp>
#include <Entity/MiningRigEntity/MiningRigEntity.hpp>

void EntityRegistry::registerAllEntities()
{
    registerEntity<Player>("main:player");
    registerEntity<ItemEntity>("main:itemEntity");
    registerEntity<MiningRigEntity>("main:miningRigEntity");
}

std::shared_ptr<Entity> EntityRegistry::createEntity(World &world, std::string typeId, uint64_t id, const uint8_t *data, size_t size)
{
    if (!m_factories.contains(typeId))
    {
        return nullptr;
    }

    return m_factories[typeId](world, id, data, size);
}

EntityRegistry entityRegistry;