#pragma once
#include <string>
#include <spdlog/spdlog.h>

namespace lsp::utils
{
    struct ServerConfig
    {
        bool use_stderr = false;
        bool show_help = false;
        size_t thread_count = 4;
        spdlog::level::level_enum log_level = spdlog::level::info;
        std::string log_file;
        std::string interpreter_path;
    };

    class ArgsParser
    {
    public:
        ArgsParser(const ArgsParser&) = delete;
        ArgsParser& operator=(const ArgsParser&) = delete;
        static ArgsParser& Instance();

        const ServerConfig& Parse(int argc, char* argv[]);
        const ServerConfig& GetConfig() const;

        static void SetupLogger(const ServerConfig& config);
        static void PrintHelp(const std::string& program_name);

    private:
        ArgsParser() = default;
        ~ArgsParser() = default;

        ServerConfig config_;
    };
}
