#pragma once

#include "../shared/utils/json_config.h"
#include <string>

namespace scar {

class ServerConfig {
public:
    ServerConfig();
    
    // Load configuration (JSON with hardcoded defaults as fallback)
    void load(const std::string& config_file = "server.json");
    
    // Getters
    std::string dbPath() const { return db_path_; }
    std::string certPath() const { return cert_path_; }
    std::string keyPath() const { return key_path_; }
    std::string host() const { return host_; }
    uint16_t port() const { return port_; }
    std::string jwtSecret() const { return jwt_secret_; }
    
    // Setters (for command-line overrides)
    void setDbPath(const std::string& path) { db_path_ = path; }
    void setCertPath(const std::string& path) { cert_path_ = path; }
    void setKeyPath(const std::string& path) { key_path_ = path; }
    
private:
    std::string db_path_;
    std::string cert_path_;
    std::string key_path_;
    std::string host_;
    uint16_t port_;
    std::string jwt_secret_;
    
    // Hardcoded defaults
    static constexpr const char* DEFAULT_DB_PATH = "scarchat.db";
    static constexpr const char* DEFAULT_CERT_PATH = "server.pem";
    static constexpr const char* DEFAULT_KEY_PATH = "server.key";
    static constexpr const char* DEFAULT_HOST = "0.0.0.0";
    static constexpr uint16_t DEFAULT_PORT = 8443;
    static constexpr const char* DEFAULT_JWT_SECRET = "CHANGE_THIS_SECRET_IN_PRODUCTION";
};

} // namespace scar
