#ifndef JNR_STATS_H
#define JNR_STATS_H

/* Per-session gameplay statistics, accumulated during play and
 * submitted to the analytics backend when the session ends. */
typedef struct GameStats {
    int     score;              /* composite score                */
    int     levels_completed;   /* exit zone triggers             */
    int     enemies_killed;     /* total kills                    */
    int     deaths;             /* player respawn count           */
    int     shots_fired;        /* projectiles spawned by player  */
    int     shots_hit;          /* player projectiles that hit    */
    int     dashes_used;        /* dash activations               */
    int     jumps;              /* jump count                     */
    int     pickups_collected;  /* all powerup pickups            */
    int     damage_taken;       /* total HP lost                  */
    int     damage_dealt;       /* total HP dealt to enemies      */
    float   time_elapsed;       /* wall-clock seconds             */
} GameStats;

/* Reset all stats to zero (call at session start). */
void stats_reset(GameStats *s);

/* Recompute the composite score from raw metrics. */
void stats_update_score(GameStats *s);

/* Set/get the active stats instance (global pointer used by
 * level.c and player.c to record events during gameplay). */
void stats_set_active(GameStats *s);
GameStats *stats_get_active(void);

/* Convenience: increment a stat on the active instance (no-op if NULL). */
void stats_record_kill(void);
void stats_record_death(void);
void stats_record_shot_fired(void);
void stats_record_shot_hit(void);
void stats_record_dash(void);
void stats_record_jump(void);
void stats_record_pickup(void);
void stats_record_damage_taken(int amount);
void stats_record_damage_dealt(int amount);

#endif /* JNR_STATS_H */
