#pragma once

#include "UI/base/IGUIElement.hpp"
#include <unordered_map>
#include "Types.hpp"
#include <future>
#include <atomic>
#include <optional>

namespace TSE::EDITOR
{
    struct CreateItemState
    {
        bool confirmed = false;
        char nameBuf[256] = "";
        char pathBuf[1024] = "";

        std::atomic<bool> pickingFolder{false};
        std::future<std::optional<string>> pickFuture;
    };

    class ViewportController
    {
    private:
        bool dockSpaceOpen = true;
        std::unordered_map<string, IGUIElement*> uiElements;
        CreateItemState gCreateState;

    public:
        ViewportController();

        void ShowFileMenu();
        void NewProjectPopup();
        void ShowViewsMenu();
        void MenuBar();
        void Docking();
        void Update();
        void AddGuiElement(const std::string& name, IGUIElement* element);
        IGUIElement* GetGuiElement(const std::string& name);
    };
} // namespace TSE::Editor
