#pragma once
#include <optional>
#include <string_view>
#include <unordered_map>
#include <vector>
#include "./types.hpp"

namespace lsp::language::keyword
{
    class Repo
    {
    public:
        Repo(const Repo&) = delete;
        Repo& operator=(const Repo&) = delete;

        static Repo& Instance();
        std::vector<Info> GetAll();
        std::vector<Info> FindByPrefix(std::string_view prefix);
        std::optional<Info> FindByName(std::string_view name);

    private:
        Repo();
        void Load();

        void LoadProgramStructure();
        void LoadDataTypes();
        void LoadClasses();
        void LoadControlFlow();
        void LoadOperators();
        void LoadSql();
        void LoadBuiltins();
        void LoadConstants();

        // std::unordered_map<std::string, Info, std::hash<std::string_view>, std::equal_to<>> keywords_;
        std::unordered_map<std::string, Info> keywords_;
    };
}
