#pragma once
#include <map>
#include <string>

// -------------------------------------------------------------------------
// OverlayConfig — all user-editable runtime settings.
// Persisted as config/overlay.json (nlohmann/json).
// -------------------------------------------------------------------------

struct OverlayConfig {
    // ---- ESP toggles ----
    bool showPlayers  = true;
    bool showAnimals  = true;
    bool showZombies  = true;
    bool showItems    = true;
    bool showBox      = true;   // bounding box around players
    bool showSkeleton = true;   // bone skeleton lines

    // ---- Extra ESP options ----
    bool showHeadDot      = false;  // dot at head bone for players/zombies
    bool showCorpses      = false;  // show dead players/zombies (dimmed grey)
    bool showWeapon       = true;   // item-in-hands label below player name
    bool showHealthBar    = true;   // vertical health bar to the right of the box
    bool showHealthNumber = false;  // numeric "xxx/100" beside the bar

    // ---- Draw-distance limits (metres) ----
    float playerMaxDist = 1000.0f;
    float animalMaxDist = 1000.0f;
    float zombieMaxDist = 500.0f;
    float itemMaxDist   = 200.0f;

    // ---- Per-category item toggles (key = filterKey from item_filters.json) ----
    // Missing key → enabled by default.
    std::map<std::string, bool> itemCategories;

    // ---- Overlay resolution override ----
    // 0 = auto-detect from GetSystemMetrics (default behaviour).
    // Set both to your MONITOR (display) resolution, not the game render resolution.
    int overlayWidth  = 0;
    int overlayHeight = 0;

    // ---- Stretched resolution support ----
    // renderWidth / renderHeight: the resolution DayZ actually renders at
    // (e.g. 1280x960 when running 4:3 stretched on a 1920x1080 monitor).
    // Set to 0 to disable (assumes render == display).
    //
    // stretchToFill: true  = GPU stretches the render to fill the monitor (no black bars).
    //               false = game maintains aspect ratio with letterbox/pillarbox bars.
    //
    // overlayWidth/Height should ALWAYS equal your monitor resolution regardless of mode.
    int  renderWidth   = 0;
    int  renderHeight  = 0;
    bool stretchToFill = true;

    // ---- Web radar ----
    std::string webBindAddress = "0.0.0.0";
    int         webPort        = 7777;
    std::string webPassword    = "";

    // ------------------------------------------------------------------
    // Load from path (returns default-constructed config on any error).
    static OverlayConfig Load(const std::string& path);

    // Save to path (creates parent directories if needed).
    void Save(const std::string& path) const;
};
