//
// Created by spenc on 5/14/2025.
//

#ifndef CORE_H
#define CORE_H
#define OX_ENGINE_VERSION "Onyx Engine (2025.1)"


#include <utility>
#include <vector>
#include <memory>
#include "Layer.h"
#include "renderer/Renderer.h"
#include "systems/Logger.h"
#include "systems/Profiler.h"
#include "systems/WindowManager.h"
#include "systems/MACROS.h"
#include "systems/Scene/Scene.h"


namespace OX
{
    class Core
    {
    public:
        Core(std::string name) : m_name(std::move(name))
        {
        };

        Core() : m_name(OX_ENGINE_VERSION)
        {
        };

        ~Core() = default;

        void Init();

        void Run();

        void Shutdown();


        WindowManager &GetWindow() { return window; }
        Renderer &GetRenderer() { return renderer; }
        Scene &GetScene() { return m_activeScene; }

        void AddLayer(std::unique_ptr<Layer> layer);

    private:
        void Update();

        void Draw();


        std::vector<std::unique_ptr<Layer> > m_layers;
        WindowManager window;
        Renderer renderer;

        Scene m_activeScene;

        bool m_running = false;
        std::string m_name = "Application";
    };

    class DummyLayer : public Layer
    {
    public:
        explicit DummyLayer(const std::string &name = "Dummy Layer")
            : Layer(name)
        {
        }

        void Init(Core &core) override
        {
            Logger::LogDebug("%s Init", m_name.c_str());
        }

        void Update(Core &core) override
        {
        }

        void Draw(Core &core) override
        {
        }

        void Shutdown(Core &core) override
        {
            Logger::LogDebug("%s Shutdown", m_name.c_str());
        }
    };
}
#endif // CORE_H
