export interface Game {
  id: number
  name: string
  slug: string
  generation: number
  region: string
  boxArtUrl: string | null
  releaseYear: number | null
  color: string | null
}

export interface Route {
  id: number
  name: string
  gameId: number
  order: number
  parentRouteId: number | null
  encounterMethods: string[]
}

export interface RouteWithChildren extends Route {
  children: Route[]
}

export interface Pokemon {
  id: number
  pokeapiId: number
  nationalDex: number
  name: string
  types: string[]
  spriteUrl: string | null
}

export interface RouteEncounter {
  id: number
  routeId: number
  pokemonId: number
  encounterMethod: string
  encounterRate: number
  minLevel: number
  maxLevel: number
}

export interface RouteEncounterDetail extends RouteEncounter {
  pokemon: Pokemon
}

export type EncounterStatus = 'caught' | 'fainted' | 'missed'

export interface Encounter {
  id: number
  runId: number
  routeId: number
  pokemonId: number
  currentPokemonId: number | null
  nickname: string | null
  status: EncounterStatus
  catchLevel: number | null
  faintLevel: number | null
  deathCause: string | null
  caughtAt: string
}

export type RunStatus = 'active' | 'completed' | 'failed'

export interface NuzlockeRun {
  id: number
  gameId: number
  name: string
  status: RunStatus
  rules: NuzlockeRules
  startedAt: string
  completedAt: string | null
}

export interface RunDetail extends NuzlockeRun {
  game: Game
  encounters: EncounterDetail[]
}

export interface EncounterDetail extends Encounter {
  pokemon: Pokemon
  currentPokemon: Pokemon | null
  route: Route
}

export interface Evolution {
  id: number
  fromPokemonId: number
  toPokemon: Pokemon
  trigger: string
  minLevel: number | null
  item: string | null
  heldItem: string | null
  condition: string | null
}

export interface CreateRunInput {
  gameId: number
  name: string
  rules?: NuzlockeRules
}

export interface UpdateRunInput {
  name?: string
  status?: RunStatus
  rules?: NuzlockeRules
}

export interface CreateEncounterInput {
  routeId: number
  pokemonId: number
  nickname?: string
  status: EncounterStatus
  catchLevel?: number
}

export interface UpdateEncounterInput {
  nickname?: string
  status?: EncounterStatus
  faintLevel?: number
  deathCause?: string
  currentPokemonId?: number
}

// Re-export for convenience
import type { NuzlockeRules } from './rules'
export type { NuzlockeRules }
