/******************************************************************************
*	File		-	editor.h
*	Author		-	Joey Pollack
*	Date		-	2021/11/01 (y/m/d)
*	Mod Date	-	2021/11/01 (y/m/d)
*	Description	-	Entry point for the editor run mode.
******************************************************************************/

#ifndef EDITOR_H_
#define EDITOR_H_

#include <core/iRunMode.h>
#include <utils/opRes.h>
#include "panels/iPanel.h"

#include "project/project.h"

#include <filesystem>
#include <map>

namespace lunarium
{
    class FileBrowser;
    class MainPanel;
    class Editor : public iRunMode
    {
    public:
        Editor();
        OpRes Initialize();
        void Shutdown();
        void OnTick(double delta);
        void OnRender(IGraphics* g);


        uint32_t GetLogCat() const;

        // Menu Bar Events
        void NewProject();
        void OpenProject();
        void SaveProject();
        void SaveAs();
        void Exit();

        void ShowAboutPanel();

    private:
        Editor(const Editor&) = delete;
        const Editor& operator=(const Editor&) = delete;
        
    private:    // Data
        uint32_t mLogCat;
        MainPanel* mpMainPanel;
        std::map<PanelType, Panel*> mPanels;

        Project mProject;

        FileBrowser* mpFileBrowser;
        const std::filesystem::path* mpPath;

        // Menu Bar Events
        // Don't want to handles these events during rendering
        bool mDoNewProject;
        bool mDoOpenProject;
        bool mDoSaveProject;
        bool mDoSaveAs;
        

    private:    // HELPERS
        void CreatePanels();
        void DestoryPanels();
        void HandleMenuEvents();
    };
}

#endif  // EDITOR_H_