#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
#include "utils/Config.h"

// Simple file logger
void log_msg(const std::string& msg) {
    std::ofstream log("main_no_ui.log", std::ios::app);
    log << msg << std::endl;
    log.flush();
}

int main(int argc, char** argv) {
    (void)argc;
    (void)argv;

    log_msg("MAIN (NO UI): Entry point reached");
    MessageBoxA(NULL, "SecondVoice (NO UI) starting...", "Debug", MB_OK);

    log_msg("About to test Config loading...");
    log_msg("Config header included");

    secondvoice::Config& config = secondvoice::Config::getInstance();
    log_msg("Config instance obtained");

    if (!config.load("config.json", ".env")) {
        log_msg("ERROR: Failed to load configuration");
        MessageBoxA(NULL, "Failed to load configuration!", "Error", MB_OK | MB_ICONERROR);
        return 1;
    }

    log_msg("Configuration loaded successfully!");
    MessageBoxA(NULL, "Config loaded successfully!", "Success", MB_OK);

    return 0;
}
