#include <Controller/GadgetController/JetpackController/JetpackController.hpp>
#include <Controller/GadgetController/MinimapController/MinimapController.hpp>
#include <ControllerRegistry/ControllerRegistry.hpp>
#include <Controller/InventoryController/InventoryController.hpp>
#include <Controller/InventoryController/CrateController/CrateController.hpp>
#include <Controller/InventoryController/MiningRigController/MiningRigController.hpp>
#include <Controller/InventoryController/PotController/PotController.hpp>
#include <Controller/InventoryController/BarrelController/BarrelController.hpp>
#include <Controller/InventoryController/GrindingBowlController/GrindingBowlController.hpp>
#include <Controller/InventoryController/PumpController/PumpController.hpp>
#include <Controller/InventoryController/SteamGeneratorController/SteamGeneratorController.hpp>
#include <Controller/InventoryController/ChemicalReactorController/ChemicalReactorController.hpp>
#include <Controller/InventoryController/EngineeringTableController/EngineeringTableController.hpp>
#include <Controller/InventoryController/AccumulatorController/AccumulatorController.hpp>
#include <Controller/InventoryController/OilRefineryController/OilRefineryController.hpp>
#include <Controller/InventoryController/CombustionGeneratorController/CombustionGeneratorController.hpp>
#include <Controller/InventoryController/ItemProcessorController/ItemProcessorController.hpp>
#include <Controller/InventoryController/ItemExtractorController/ItemExtractorController.hpp>
#include <Controller/InventoryController/BeltJunctionController/BeltJunctionController.hpp>
#include <Controller/InventoryController/UraniumRefineryController/UraniumRefineryController.hpp>
#include <Controller/InventoryController/NuclearReactorController/NuclearReactorController.hpp>
#include <Controller/InventoryController/SubstationController/SubstationController.hpp>
#include <Controller/InventoryController/QuartzClockController/QuartzClockController.hpp>
#include <Controller/InventoryController/LogicBoxController/LogicBoxController.hpp>
#include <Controller/MapController/MapController.hpp>
#include <Machine/MItemProcessor/MMacerator/MMacerator.hpp>
#include <Machine/MItemProcessor/MElectricFurnace/MElectricFurnace.hpp>
#include <Entity/PhysicsEntity/CameraEntity/Player/Player.hpp>

ControllerRegistry controllerRegistry;

void ControllerRegistry::registerAllControllers()
{
    registerController<InventoryController>("main:PlayerInventoryController");
    registerController<InventoryController>("main:ConstructionTableController", ItemRecipe::Level::Table);
    registerController<CrateController>("main:CrateController");
    registerController<PotController>("main:IronPotController");
    registerController<PotController>("main:StonePotController");
    registerController<BarrelController>("main:BarrelController");
    registerController<GrindingBowlController>("main:GrindingBowlController");
    registerController<PumpController>("main:PumpController");
    registerController<SteamGeneratorController>("main:SteamGeneratorController");
    registerController<ChemicalReactorController>("main:ChemicalReactorController");
    registerController<EngineeringTableController>("main:EngineeringTableController");
    registerController<AccumulatorController>("main:AccumulatorController");
    registerController<OilRefineryController>("main:OilRefineryController");
    registerController<CombustionGeneratorController>("main:CombustionGeneratorController");
    registerController<ItemProcessorController<MMacerator>>("main:ItemProcessorController:main:macerator");
    registerController<ItemProcessorController<MElectricFurnace>>("main:ItemProcessorController:main:electricFurnace");
    registerController<ItemExtractorController>("main:ItemExtractorController");
    registerController<MiningRigController>("main:MiningRigController");
    registerController<BeltJunctionController>("main:BeltJunctionController");
    registerController<UraniumRefineryController>("main:UraniumRefineryController");
    registerController<NuclearReactorController>("main:NuclearReactorController");
    registerController<SubstationController>("main:SubstationController");
    registerController<QuartzClockController>("main:QuartzClockController");
    registerController<LogicBoxController>("main:LogicBoxController");
    registerController<MapController>("main:MapController");
    registerController<MinimapController>("main:MinimapController");
    registerController<JetpackController>("main:JetpackController");
}

std::unique_ptr<Controller> ControllerRegistry::createController(ControllerChannel &channel, std::string id)
{
    if (m_factories.count(id) != 1)
    {
        return nullptr;
    }

    return m_factories[id](channel);
}