//
// Created by sebastian on 24.12.25.
//

#ifndef DICEWARS_SIEDLER_GAMELAYER_H
#define DICEWARS_SIEDLER_GAMELAYER_H
#include "../engine/core/ECS/RenderSystem.h"
#include "../engine/layer/Layer.h"
#include "../engine/platform/glfw/MousePicker.h"
#include "../engine/renderer/Renderer.h"
#include "../engine/renderer/loader/Loader.h"
#include "../engine/renderer/model/TexturedModel.h"
#include "../engine/layer/entities/Camera.h"
#include "../engine/renderer/MasterRenderer.h"
#include "hexWorld/Map.h"
#include "hexWorld/ecs/systems/BuildingPlacementSystem.h"
#include "hexWorld/ecs/systems/TileHighlightSystem.h"


class GameLayer: public Layer {
public:
    GameLayer();
    ~GameLayer() override = default;

    void onAttach() override;
    void onDetach() override;
    void onUpdate() override;

    void setGameMode(std::shared_ptr<GameMode> gameMode);

private:
    std::shared_ptr<GameMode> gameMode;

    TexturedModel texturedModel;
    std::unique_ptr<Camera> camera;
    std::unique_ptr<Light> light;
    std::unique_ptr<MousePicker> mousePicker;
    std::unique_ptr<MasterRenderer> renderer = std::make_unique<MasterRenderer>();

    std::shared_ptr<TexturedModel> hexModelDefault;
    std::shared_ptr<TexturedModel> hexModelWood;
    std::shared_ptr<TexturedModel> hexModelStone;

    std::vector<std::shared_ptr<Entity>> mapEntities;
    std::vector<std::shared_ptr<Entity>> entities;

    std::unique_ptr<RenderSystem> renderSystem = std::make_unique<RenderSystem>();
    std::unique_ptr<TileHighlightSystem> tileHighlightSystem = std::make_unique<TileHighlightSystem>();
    std::unique_ptr<BuildingPlacementSystem> buildingPlacementSystem = std::make_unique<BuildingPlacementSystem>();
    std::unique_ptr<EntityManager> entityManager = std::make_unique<EntityManager>();

    std::unique_ptr<Map> map;
};


#endif //DICEWARS_SIEDLER_GAMELAYER_H