#ifndef JNR_SPRITES_H
#define JNR_SPRITES_H

#include <SDL2/SDL.h>
#include "engine/animation.h"

/* Sprite sheet layout:
 * Each sprite cell is 16x16 pixels.
 * The sheet is organized in rows:
 *
 * Row 0: Player idle (2 frames), run (4 frames), jump (1), fall (1)
 * Row 1: Grunt idle (2 frames), walk (4 frames), death (2 frames)
 * Row 2: Flyer idle (2 frames), fly (4 frames), death (2 frames)
 * Row 3: Projectiles: bullet (2 frames), impact (3 frames), enemy bullet (2)
 */

#define SPRITE_CELL  16

/* Generate the spritesheet texture (call after renderer is ready) */
SDL_Texture *sprites_generate(SDL_Renderer *renderer);

/* ── Player animations ─────────────────────────── */
extern AnimDef anim_player_idle;
extern AnimDef anim_player_run;
extern AnimDef anim_player_jump;
extern AnimDef anim_player_fall;

/* ── Grunt animations ──────────────────────────── */
extern AnimDef anim_grunt_idle;
extern AnimDef anim_grunt_walk;
extern AnimDef anim_grunt_death;

/* ── Flyer animations ──────────────────────────── */
extern AnimDef anim_flyer_idle;
extern AnimDef anim_flyer_fly;
extern AnimDef anim_flyer_death;

/* ── Projectile animations ─────────────────────── */
extern AnimDef anim_bullet;
extern AnimDef anim_bullet_impact;
extern AnimDef anim_enemy_bullet;

/* ── Hazard animations ─────────────────────────── */
extern AnimDef anim_turret_idle;
extern AnimDef anim_turret_fire;
extern AnimDef anim_platform;
extern AnimDef anim_flame_vent_idle;
extern AnimDef anim_flame_vent_active;
extern AnimDef anim_force_field_on;
extern AnimDef anim_force_field_off;

/* ── Powerup animations ────────────────────────── */
extern AnimDef anim_powerup_health;
extern AnimDef anim_powerup_jetpack;
extern AnimDef anim_powerup_fuel;
extern AnimDef anim_powerup_drone;
extern AnimDef anim_powerup_gun;

/* ── Asteroid animation ─────────────────────────── */
extern AnimDef anim_asteroid;

/* ── Drone animation ───────────────────────────── */
extern AnimDef anim_drone;

/* Initialize all animation definitions */
void sprites_init_anims(void);

/* The global spritesheet texture */
extern SDL_Texture *g_spritesheet;

#endif /* JNR_SPRITES_H */
