/******************************************************************************
*	File		-	asset_browser.h
*	Author		-	Joey Pollack
*	Date		-	2021/11/10 (y/m/d)
*	Mod Date	-	2021/11/10 (y/m/d)
*	Description	-	Browse and manage project assets
******************************************************************************/

#ifndef ASSET_BROWSER_H_
#define ASSET_BROWSER_H_

#include <gui/panel.h>
#include <editor/editor.h>

#include <filesystem>
#include <vector>

namespace lunarium
{
namespace editor
{
    class EditorAsset;
    
    class AssetBrowser : public Panel
    {
    public:
        AssetBrowser(std::filesystem::path dir, Editor* pEditor);
        void SetAssetDirectory(std::filesystem::path dir);

        void DoFrame();

        std::filesystem::path GetSelectedDirectory();

    private:
        std::filesystem::path mAssetDirectory;
        std::filesystem::path mSelectedDir;
        Editor* mpEditor;
        bool mSyncTree;

    private:
        void DefinePopups();

        // Frame helpers
        void DoDirTree(std::filesystem::path dir);
        void DoContentArea(ImVec2 wind_size);

        // Context menus
        void DoContentContextMenu();

        // General Helpers
        void HandleAssetDrop(std::filesystem::path dir);
        void HandleAssetDoubleClick(EditorAsset* pAsset);


    private: // POPUP ENUMS
        enum PopUp
        {
            NEW_FOLDER,
            NEW_WORLD,
        };
    };

}
}

#endif  // ASSET_BROWSER_H_