import type { BossGroupId } from "../game/bossCatalog";
import type { BossId, HealerClassId, InventoryItem } from "../game/types";
import type { GearProgress } from "../game/progression/gear";
import type { CollectionLog, MaterialStack } from "../game/progression/loot";
import type { CharacterAppearanceV1 } from "../game/characterAppearance";

export type SaveSlotId = 1 | 2 | 3;
export type AppScreen = "login" | "saves" | "home" | "class-help" | "profile" | "gear" | "appearance" | "settings" | "mode" | "game";
export type GameModeId = "roguelike-pve" | "rogue-trials" | "dungeons" | "hockey-healing" | "hockey-healing-pvp" | "blockbreaker" | "aether-assault" | "roguelike-pvp" | "stadium-pvp";
export type ProfileCollectionView = "loot" | "trophies" | "stats";
export type ProfileStatId = BossId | "roguelike" | "rogue-trials-endless" | "hockey-healing" | "hockey-pvp-wins" | "hockey-pvp-boss-kills" | "blockbreaker-bricks" | "blockbreaker-time" | "blockbreaker-score" | "aether-assault";

export interface CollectionDrop {
  id: string;
  name: string;
  icon: string;
  rarity: "Common" | "Uncommon" | "Rare" | "Epic" | "Legendary";
  count: number;
  chance: string;
  itemLevel?: number;
  kind: "group-drop" | "pet";
}

export interface GroupBossCollection {
  bossId: BossId;
  bossName: string;
  kills: number;
  pet: CollectionDrop;
}

export interface BossGroupCollection {
  groupId: BossGroupId;
  groupLetter: string;
  groupName: string;
  coreMechanic: string;
  defeated: boolean;
  drops: CollectionDrop[];
  bosses: GroupBossCollection[];
}

export interface HunterStats {
  totalBossKills: number;
  flawlessClears: number;
  alliesSaved: number;
  healingDone: number;
  bossKills: Record<string, number>;
  highestRoguelikeRound: number;
  highestRogueTrialsEndlessKills: number;
  highestHockeyHealingReturns: number;
  longestHockeyHealingSecondsAtBest: number;
  hockeyHealingPvpWins: number;
  hockeyHealingPvpLosses: number;
  hockeyHealingPvpBossKills: number;
  highestBlockbreakerBricks: number;
  longestBlockbreakerSeconds: number;
  highestBlockbreakerScore: number;
  highestAetherAssaultScore: number;
  highestAetherAssaultWaveAtBest: number;
  longestAetherAssaultSecondsAtBest: number;
}

export interface HealerProgress {
  level: number;
  inventory: InventoryItem[];
  appearance: CharacterAppearanceV1;
}

export interface HunterSave {
  schemaVersion: 6;
  slotId: SaveSlotId;
  hunterName: string;
  activeClassId: HealerClassId;
  healers: Record<HealerClassId, HealerProgress>;
  location: string;
  playSeconds: number;
  updatedAt: string;
  stats: HunterStats;
  materials: MaterialStack[];
  collectionLog: CollectionLog;
  gearProgress: GearProgress;
}

export interface SaveSlotState {
  id: SaveSlotId;
  local: HunterSave | null;
  online: HunterSave | null;
}

export interface GameSettings {
  masterVolume: number;
  reducedMotion: boolean;
  damageNumbers: boolean;
  largeText: boolean;
}
