#include "Texture.h"
#include "AssetManager.h"
#include "Logging.h"

Texture::Texture(const std::string &path)
{
    if (!path.empty())
    {
        AssetManager::LoadAssetAsync(path, AssetType::Image);
        const auto *asset = AssetManager::GetAssetByPath(path);
        if (asset && asset->loaded)
        {
            id = asset->textureID;
            size = asset->size;
        }
        else
        {
            Logger::LogError("[Texture] Failed to get asset for path: %s", path.c_str());
        }
    }
}



Texture::Texture(uint64_t uaid)
{
    const auto *asset = AssetManager::GetAssetByID(uaid);
    if (asset && asset->loaded)
    {
        id = asset->textureID;
        size = asset->size;
    }
    else
    {
        Logger::LogError("[Texture] Failed to get asset for UAID: %llu", uaid);
    }
}

Texture::~Texture() {}

unsigned int Texture::GetID() const
{
    return id;
}
