#pragma once

#define BASIC_EDITOR_CAMERA typeid(basicEditorCamera).name()

#include "elements/BehaviourScript.hpp"
#include "interfaces/ICursorHandler.hpp"
#include "interfaces/IKeyInputHandler.hpp"
#include "Vector2.hpp"
#include "Vector3.hpp"
#include "imgui/imgui.h"
#include "UI/windows/SceneView.hpp"

namespace TSE::EDITOR
{
    class basicEditorCamera : public BehaviourScript, public ICursorHandler, public IKeyInputHandler
    {
    private:
        bool keyInputEnabled = true;
        bool mouseInputEnabled = true;

        bool isShiftPressed = false;
        bool holdingRightClick = false;
        bool holdingLeftClick = false;
        Vector3 delta = Vector3::zero;
        Vector3 keydelta = Vector3::zero;
        Vector2 rotDelta = Vector2::zero;
        Vector2 lastMousepos;
        float keyMultiplier = 0.5f;

        float rotationMultiplier = 150;
        float movementMultiplier = 64;
        float zoomMultiplier = 2;

        const float zoomMin = 6;
        const float zoomMax = 500;

        public:
        void OnUpdate() override;
        void Start() override;
        inline const char* GetName() override
        {
            return "basicEditorCamera";
        }

        void OnKeyDown(const Key& key, const Modifier& mods) override;
        
        void OnKeyUp(const Key& key, const Modifier& mods) override;
        
        void OnMouseButtonDown(const MouseBtn& btn, const Modifier& mods) override;
        
        void OnMouseButtonUp(const MouseBtn& btn, const Modifier& mods) override;
        
        void OnMousePosition(const Vector2& pos) override;
        
        void OnMouseScroll(const Vector2& delta) override;

        void CustomDraw(const bool& debug) override;

    };
} // namespace TSE::EDITOR
