#include "adapters/hooks/HookDiagnostics.h"

#include "foundation/diagnostics/Metrics.h"

namespace ta::adapters::hooks::diagnostics
{
    namespace
    {
        ta::foundation::diagnostics::Counter application_update_hits;
        ta::foundation::diagnostics::Counter game_world_update_hits;
        ta::foundation::diagnostics::Counter gameworld_dispatch_hits;
        ta::foundation::diagnostics::Counter player_fixed_update_hits;
        ta::foundation::diagnostics::Counter local_game_stop_hits;
    }

    void reset() noexcept
    {
        application_update_hits.reset();
        game_world_update_hits.reset();
        gameworld_dispatch_hits.reset();
        player_fixed_update_hits.reset();
        local_game_stop_hits.reset();
    }

    void mark_tarkov_application_update() noexcept { application_update_hits.increment(); }
    void mark_game_world_update() noexcept { game_world_update_hits.increment(); }
    void mark_gameworld_update_dispatch() noexcept { gameworld_dispatch_hits.increment(); }
    void mark_player_fixed_update() noexcept { player_fixed_update_hits.increment(); }
    void mark_local_game_stop() noexcept { local_game_stop_hits.increment(); }

    ta::application::diagnostics::HookDiagnosticsSnapshot snapshot() noexcept
    {
        return {
            application_update_hits.value(),
            game_world_update_hits.value(),
            gameworld_dispatch_hits.value(),
            player_fixed_update_hits.value(),
            local_game_stop_hits.value()
        };
    }
}
