#pragma once

#include <string>

namespace secondvoice {

struct AudioConfig {
    int sample_rate;
    int channels;
    int chunk_duration_seconds;
    int chunk_step_seconds;  // How often to emit chunks (for overlap)
    std::string format;
};

struct WhisperConfig {
    std::string model;
    std::string language;
    float temperature;
    std::string prompt;
    bool stream;
    std::string response_format;
};

struct ClaudeConfig {
    std::string model;
    int max_tokens;
    float temperature;
    std::string system_prompt;
};

struct UIConfig {
    int window_width;
    int window_height;
    int font_size;
    int max_display_lines;
};

struct RecordingConfig {
    bool save_audio;
    std::string output_directory;
};

class Config {
public:
    static Config& getInstance();

    bool load(const std::string& config_path, const std::string& env_path);

    const AudioConfig& getAudioConfig() const { return audio_config_; }
    const WhisperConfig& getWhisperConfig() const { return whisper_config_; }
    const ClaudeConfig& getClaudeConfig() const { return claude_config_; }
    const UIConfig& getUIConfig() const { return ui_config_; }
    const RecordingConfig& getRecordingConfig() const { return recording_config_; }

    const std::string& getOpenAIKey() const { return openai_key_; }
    const std::string& getAnthropicKey() const { return anthropic_key_; }

private:
    Config() = default;
    Config(const Config&) = delete;
    Config& operator=(const Config&) = delete;

    AudioConfig audio_config_;
    WhisperConfig whisper_config_;
    ClaudeConfig claude_config_;
    UIConfig ui_config_;
    RecordingConfig recording_config_;

    std::string openai_key_;
    std::string anthropic_key_;
};

} // namespace secondvoice
