/******************************************************************************
*	File		-	editor_asset.h
*	Author		-	Joey Pollack
*	Date		-	2022/02/22 (y/m/d)
*	Mod Date	-	2022/02/22 (y/m/d)
*	Description	-	Editor assets base class
******************************************************************************/

#ifndef EDITOR_ASSETS_H_
#define EDITOR_ASSETS_H_

#include "definitions.h"
#include "content_manager.h"
#include <filesystem>
#include <string>
#include <utils\op_res.h>

namespace lunarium { namespace editor 
{

    class EditorAsset
    {
    public:
        EditorAsset(AssetType type);

        AssetType GetType();
        uint64_t GetID();
        std::filesystem::path GetFileLocation();

        [[nodiscard]] virtual OpRes LoadRawFile() = 0;
        [[nodiscard]] virtual OpRes LoadFromJSON(nlohmann::json& node) = 0;
        [[nodiscard]] virtual OpRes SaveToJSON(nlohmann::json& node) = 0;

    private:
        friend class ContentManager;

        AssetType mType;
        uint64_t mID;
        std::filesystem::path mLocation;

    protected:
        std::filesystem::path mAssetDir;

        [[nodiscord]] virtual bool IsValidNode(nlohmann::json& node) = 0;
    };
}}

#endif  // EDITOR_ASSETS_H_