#pragma once
#include <nlohmann/json.hpp>
#include <fstream>
#include <codecvt>
#include <filesystem>

struct Config {
  static std::filesystem::path BASE_DIR;
  nlohmann::json $config;
  std::string $src_path;

  Config(const std::string src_path);

  Config(nlohmann::json config, std::string src_path)
    : $config(config), $src_path(src_path) {}

  nlohmann::json &operator[](size_t);
  nlohmann::json &operator[](const std::string &key);
  nlohmann::json &json() { return $config; };
  std::wstring wstring(const std::string main_key, const std::string sub_key);
  std::vector<std::string> keys();

  static void set_base_dir(const char *optarg);
  static std::filesystem::path path_to(const std::string& path);
};
