#include "Global.h"
#include "Instance.h"
#include "Tools.h"
#include "rendering/Rendering.h"

#include <imgui.h>

namespace Tools
{
    const char* GetAssetPath(uint32_t assetHandle)
    {
        const auto& inst = Game::GetInstance();
        for (int32_t j = 0; j < inst.DebugData.AssetCount; ++j)
        {
            if (inst.DebugData.AssetHandles[j] == assetHandle)
            {
                return inst.DebugData.AssetHandlePaths[j];
            }
        }
        return "---";
    }

    void ModelDropdown(uint16_t& modelHandle)
    {
        auto& R = Game::GameRendering::Get();
        const char* name = GetAssetPath(R.Models[modelHandle].AssetHandle);
        if (ImGui::BeginCombo("Models", name))
        {
            for (int32_t i = 0; i < R.ModelCount; ++i)
            {
                if (ImGui::Selectable(GetAssetPath(R.Models[i].AssetHandle), i == modelHandle))
                {
                    modelHandle = i;
                }
            }
            ImGui::EndCombo();
        }
    }
} // namespace Tools
