#pragma once
// ── CS2 External C++ WebRadar — Steam Avatar Cache ─────────────────────────
// Matches C# AvatarCache.cs: fetches Steam profile avatars via curl
// and caches them by SteamID64 for the WebRadar frontend.

#include <string>
#include <unordered_map>
#include <mutex>

class AvatarCache {
public:
    AvatarCache() = default;

    // Fetch avatar URL for a given SteamID64.
    // Returns cached value if available, otherwise fetches from Steam.
    std::string get_avatar_url(const std::string& steam_id);

    // Check if avatar is cached
    bool has(const std::string& steam_id) const;

    // Clear the cache
    void clear();

private:
    mutable std::mutex m_mutex;
    std::unordered_map<std::string, std::string> m_cache; // steam_id → avatar_url

    std::string fetch_from_steam(const std::string& steam_id);
};
