#pragma once

#include <string>
#include <vector>
#include <unordered_map>
#include <mutex>
#include <atomic>
#include <chrono>

namespace node669427 {

struct ServiceEndpoints {
    std::string xmr_wallet_url;
    std::string xmr_daemon_url;
    std::string tron_signer_url;
    std::string stripe_bridge_url;
    std::string ollama_url;
};

struct NodeConfig {
    std::string node_id;
    std::string role;
    int listen_port = 8301;
    std::string wg_interface = "wg7";
    std::string shield_ip = "10.69.69.1";
    int shield_port = 8302;
    std::string vault_path;
    std::string db_host = "127.0.0.1";
    std::string db_name = "engine";
    std::string hmac_key_path = "/dev/shm/engine_hmac.key";
    std::string bind_address = "10.69.69.6";  // NET-01: WG-only, never 0.0.0.0
    int thread_pool_size = 16;
    int request_timeout_ms = 30000;
    int heartbeat_interval_ms = 30000;
    int health_check_interval_ms = 10000;
    std::chrono::seconds artifact_ttl{3600};
    ServiceEndpoints services;

    std::atomic<bool> running{true};
    std::mutex state_mutex;

    static NodeConfig load(const std::string& config_path);
    static NodeConfig from_args(int argc, char* argv[]);
};

} // namespace node669427
