#pragma once

#include <unordered_map>
#include "interfaces/IShader.hpp"
#include "Types.hpp"

namespace TSE
{
    class ShaderRegistry
    {
    private:
        inline static std::unordered_map<string, IShader*> registeredShaders = {};

    public:
        inline static void SetShader(const string& name, IShader* shader)
        {
            registeredShaders[name] = shader;
        };
        inline static IShader* GetShader(const string& name)
        {
            return registeredShaders.at(name);
        };
        inline static void RemoveShader(const string& name)
        {
            registeredShaders.erase(name);
        };
        inline static int GetShaderCount()
        {
            return registeredShaders.size();
        }
        inline static IShader* GetShaderAt(int i)
        {
            auto it = registeredShaders.begin();
            for (int j = 0; j < i; j++)
            {
                it++;
            }
            return it->second;
        }
        inline static string GetNameAt(int i)
        {
            auto it = registeredShaders.begin();
            for (int j = 0; j < i; j++)
            {
                it++;
            }
            return it->first;
        }
    };
} // namespace TSE
