#pragma once

#include <string>

namespace dps {

struct ServerConfig {
    std::string host = "0.0.0.0";
    int port = 8651;
    bool trust_proxy = false;
    std::string proxy_header = "x-forwarded-for";
};

struct JwtConfig {
    std::string secret = "change-me";
    long long expiration_seconds = 7200;
};

struct LoggingConfig {
    std::string level = "info";
    bool http_summary = true;
    bool http_dump = false;
    int http_max_body = 2048;
};

struct FeatureConfig {
    bool video_enabled = false;
    bool payment_enabled = false;
};

struct DatabaseConfig {
    std::string host = "127.0.0.1";
    int port = 3306;
    std::string name = "rindro";
    std::string user = "root";
    std::string password;
    std::string ssl_mode = "preferred";
    std::string ssl_ca;
    std::string plugin_dir;
};

struct PathConfig {
    std::string configfile = "/root/rindro/Script/FileConfig.json";
    std::string file_root = "/root/rindro/";
    std::string file_map = "/root/rindro/file.json";
    std::string script_root = "/root/rindro/ClentScript/";
    std::string dps_root = "/home/DP_S/";
    std::string client_user_script_root = "/root/rindro/ClentUserScript/";
};

struct AppConfig {
    ServerConfig server;
    JwtConfig jwt;
    LoggingConfig logging;
    FeatureConfig features;
    DatabaseConfig database;
    PathConfig paths;
};

AppConfig load_config(const std::string &path);

}  // namespace dps
