#pragma once
#include <string>
#include <string_view>

// -------------------------------------------------------------------------
// MapInfo — metadata for a single supported DayZ map.
// -------------------------------------------------------------------------

struct MapInfo {
    std::string id;        // canonical lowercase key (e.g. "chernarusplus")
    std::string name;      // human-readable display name
    int         worldSize; // world-space units that span the full map
    int         index;     // stable ordering index
};

// -------------------------------------------------------------------------
// MapRegistry — static map database + helpers.
// -------------------------------------------------------------------------

class MapRegistry {
public:
    MapRegistry() = delete;

    /// Return a pointer to the best-matching MapInfo for the given
    /// server map name, or nullptr if no match is found.
    static const MapInfo* Resolve(std::string_view serverMapName);

    /// Convert a world-space position (worldX, worldZ) to 2-D map-image
    /// pixel-space coordinates (outX, outY).  The transform differs per map.
    static void Translate(const MapInfo& m, float worldX, float worldZ,
                          float& outX, float& outY);

    /// Return true if maps/<id>.png exists relative to the working directory.
    static bool HasMapImage(const MapInfo& m);

    /// Return the full list of known maps (used for bootstrap JSON).
    static const MapInfo* AllMaps(int& count);
};
