#include <iostream>
#include <fstream>
#include "utils/Config.h"
#include "audio/AudioCapture.h"

int main() {
    std::ofstream log("no_ui_test.log");
    log << "No UI test starting..." << std::endl;
    log.flush();

    log << "About to get Config instance..." << std::endl;
    log.flush();

    // Test Config
    secondvoice::Config& config = secondvoice::Config::getInstance();

    log << "Got Config instance, about to load..." << std::endl;
    log.flush();

    if (!config.load("config.json", ".env")) {
        log << "Failed to load config" << std::endl;
        return 1;
    }
    log << "Config loaded OK" << std::endl;

    // Test AudioCapture
    secondvoice::AudioCapture audio(16000, 1, 10);
    if (!audio.initialize()) {
        log << "Failed to initialize audio" << std::endl;
        return 1;
    }
    log << "Audio initialized OK" << std::endl;

    log << "SUCCESS - All components work without UI!" << std::endl;
    return 0;
}
