export interface CombatState {
  // Spec-compliant fields (from CombatState.spec.md)
  /** Whether combat is currently active */
  isActive: boolean;
  /** Current Round number */
  round: number;
  /** Ordered list of Unit IDs for the current round (spec format) */
  turnQueue: string[];
  /** The ID of the unit currently taking their turn (spec format) */
  activeUnitId: string | null;
  /** Current phase of the turn loop */
  phase:
    | "INIT"
    | "TURN_START"
    | "WAITING_FOR_INPUT"
    | "EXECUTING_ACTION"
    | "TURN_END"
    | "COMBAT_END";

  // UI-enriched fields (for backward compatibility)
  /** The unit currently taking their turn (enriched object for UI) */
  activeUnit: UnitStatus | null;
  /** Sorted list of units acting next (enriched objects for UI) */
  enrichedQueue?: QueueEntry[];
  /** Is the player currently targeting a skill? */
  targetingMode: boolean;
  /** Global combat info (alias for round) */
  roundNumber: number;
}

export interface UnitStatus {
  id: string;
  name: string;
  portrait: string;
  hp: { current: number; max: number };
  ap: { current: number; max: number };
  charge: number; // 0-100
  statuses: StatusIcon[];
  skills: SkillButton[];
}

export interface QueueEntry {
  unitId: string;
  portrait: string;
  team: "PLAYER" | "ENEMY";
  /** 0-100 progress to next turn */
  initiative: number;
}

export interface StatusIcon {
  id: string;
  icon: string; // URL or Emoji
  turnsRemaining: number;
  description: string;
}

export interface SkillButton {
  id: string;
  name: string;
  icon: string;
  costAP: number;
  cooldown: number; // 0 = Ready
  isAvailable: boolean; // True if affordable and ready
}

export interface CombatEvents {
  "skill-click": { skillId: string };
  "end-turn": void;
  "hover-skill": { skillId: string }; // For showing range grid
}
