#pragma once

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

namespace scar {

class ClientConfig {
public:
    ClientConfig();
    
    // Load from XDG_CONFIG_HOME or default location
    void load();
    
    // Save current configuration
    void save();
    
    // Getters
    std::string lastUsername() const { return last_username_; }
    std::string lastServer() const { return last_server_; }
    uint16_t lastPort() const { return last_port_; }
    std::string jwtToken() const { return jwt_token_; }
    
    // Setters
    void setLastUsername(const std::string& username);
    void setLastServer(const std::string& server);
    void setLastPort(uint16_t port);
    void setJwtToken(const std::string& token);
    
private:
    std::string getConfigPath();
    
    std::unique_ptr<JsonConfig> config_;
    std::string last_username_;
    std::string last_server_;
    uint16_t last_port_;
    std::string jwt_token_;
    
    static constexpr const char* DEFAULT_SERVER = "localhost";
    static constexpr uint16_t DEFAULT_PORT = 8443;
};

} // namespace scar
