#pragma once
#include <atomic>
#include <cstdint>
#include <string>
#include <vector>

#include "Web/BulletTrackCache.h"
#include "Web/MapRegistry.h"
#include "Readers/ItemFilterCatalog.h"
#include "Runtime/DayZRuntimeService.h"

// -------------------------------------------------------------------------
// WebSnapshotService
// Converts RuntimeUpdate snapshots into JSON strings consumed by the
// browser radar client.
// -------------------------------------------------------------------------

class WebSnapshotService {
public:
    /// Build the main state JSON sent on every SSE push / polling request.
    std::string BuildStateJson(const RuntimeUpdate&           update,
                               const std::vector<BulletTrack>& bullets,
                               const MapInfo*                  map,
                               int64_t                         nowMs);

    /// Build the one-time bootstrap JSON (map list, filter presets, server info).
    std::string BuildBootstrapJson(const RuntimeUpdate& update,
                                   const MapInfo*       map,
                                   int                  port);

private:
    std::atomic<int64_t> m_seq{0};
    ItemFilterCatalog    m_catalog;   // loaded from config/item_filters.json
};
