//
// Created by sebastian on 30.07.26.
//

#ifndef COLORRACE_ASSETMANAGER_H
#define COLORRACE_ASSETMANAGER_H
#include <string>
#include <unordered_map>

#include "LoadedAssets.h"
#include "loader/models/Model.h"
#include "loader/textures/Texture2D.h"


namespace engine {
    class AssetManager {
    public:
        AssetManager() = default;
        ~AssetManager() = default;

        std::shared_ptr<Model> getModel(const std::string& name) const;
        bool hasModel(const std::string& name) const;
        void insertAsset(LoadedAsset loadedAsset);
        void insertModel(const std::string& name, std::shared_ptr<Model> model);
        void unloadModel(const std::string& name);

        std::shared_ptr<Texture2D> getTexture(const std::string& name) const;
        bool hasTexture(const std::string& name) const;
        void insertTexture(const std::string& name, std::shared_ptr<Texture2D> texture);
        void unloadTexture(const std::string& name);

        std::shared_ptr<audio::SoundBuffer> getSound(const std::string& name) const;
        bool hasSound(const std::string& name) const;
        void insertSound(const std::string& name, std::shared_ptr<audio::SoundBuffer> sound);
        void unloadSound(const std::string& name);


    private:
        std::unordered_map<std::string, std::shared_ptr<Texture2D>> m_textures;
        std::unordered_map<std::string, std::shared_ptr<Model>> m_models;
        std::unordered_map<std::string, std::shared_ptr<audio::SoundBuffer>> m_loadedAssets;
    };
}

#endif //COLORRACE_ASSETMANAGER_H
