#ifndef ENCYCLOPEDIA_HPP_
#define ENCYCLOPEDIA_HPP_

#include <EncyclopediaCategory/EncyclopediaCategory.hpp>
#include <memory>
#include <string>
#include <unordered_map>

class Encyclopedia final
{
private:
    std::unordered_map<std::string, std::shared_ptr<EncyclopediaCategory>> categories;
    std::unordered_map<std::string, std::string> pageCache;

    template<typename TCategory>
    void registerCategory(const std::string &categoryName)
    {
        categories[categoryName] = std::make_shared<TCategory>();
    }

public:
    void init();
    const std::string* tryGetPage(const std::string &url);
};

extern Encyclopedia encyclopedia;

#endif