#ifndef SCENE_HPP
#define SCENE_HPP

#include "open_engine/renderer/editor_camera.hpp"

#include <entt/entt.hpp>
#include <cstdint>

namespace OpenEngine {

    class Entity;
    
    class Scene
    {
        public:
            Scene() {};
            ~Scene() = default;

            Entity CreateEntity(const std::string& name = std::string());
            void DeleteEntity(Entity entity);

            void OnUpdateRuntime();
            void OnUpdateEditor(EditorCamera& camera);
            void OnViewportResize(uint32_t width, uint32_t height);

            entt::registry& GetRegistry() { return registry; };

            Entity GetPrimaryCamera();

        private:
            template<typename T>
                void OnComponentAdded(Entity entity, T& component);

        private:
            entt::registry registry;

            uint32_t viewport_width = 0, viewport_height = 0;

            friend class SceneSerializer;
            friend class Entity;
    };
}

#endif // SCENE_HPP
