// Card Types
export type CardType =
  | 'grass'
  | 'fire'
  | 'water'
  | 'lightning'
  | 'psychic'
  | 'fighting'
  | 'darkness'
  | 'metal'
  | 'fairy'
  | 'dragon'
  | 'colorless'

export type CardCategory = 'pokemon' | 'trainer' | 'energy'

export interface Card {
  id: string
  definitionId: string
  name: string
  category: CardCategory
  type?: CardType
  hp?: number
  currentHp?: number
  attacks?: Attack[]
  imageUrl?: string
  // Status effects for Pokemon
  status?: StatusEffect[]
  // Attached cards (energy, tools)
  attachments?: Card[]
}

export interface Attack {
  name: string
  cost: CardType[]
  damage: number
  effect?: string
  effectParams?: Record<string, unknown>
}

export interface StatusEffect {
  type: 'poisoned' | 'burned' | 'asleep' | 'paralyzed' | 'confused'
  turnsRemaining?: number
}

// Game State Types
export type GamePhase = 'setup' | 'draw' | 'main' | 'attack' | 'end'

export interface Player {
  id: string
  username: string
  isMe: boolean
  hand: Card[]
  active: Card | null
  bench: Card[]
  prizes: Card[]
  prizeCount: number
  deckCount: number
  discardPile: Card[]
}

export interface GameState {
  id: string
  players: Player[]
  currentPlayerId: string
  phase: GamePhase
  turnNumber: number
  winner?: string
  // Actions available to current player
  availableActions?: string[]
}

// API Response Types
export interface ApiError {
  detail: string
  code?: string
}

export interface PaginatedResponse<T> {
  items: T[]
  total: number
  page: number
  pageSize: number
  totalPages: number
}

// Collection Types
export interface CollectionCard {
  cardDefinitionId: string
  quantity: number
  card: CardDefinition
}

export interface CardDefinition {
  id: string
  name: string
  category: CardCategory
  type?: CardType
  hp?: number
  attacks?: Attack[]
  imageUrl: string
  rarity: 'common' | 'uncommon' | 'rare' | 'holo' | 'ultra'
  setId: string
  setNumber: number
}

// Deck Types
export interface Deck {
  id: string
  name: string
  cards: DeckCard[]
  isValid: boolean
  cardCount: number
}

export interface DeckCard {
  cardDefinitionId: string
  quantity: number
  card: CardDefinition
}

// Campaign Types
export interface Club {
  id: string
  name: string
  description: string
  iconUrl: string
  members: ClubMember[]
  leader: ClubMember
  isDefeated: boolean
}

export interface ClubMember {
  id: string
  name: string
  portraitUrl: string
  difficulty: 'easy' | 'medium' | 'hard' | 'leader'
  isDefeated: boolean
  deckTheme: CardType
}

export interface CampaignProgress {
  clubsDefeated: string[]
  medalsEarned: string[]
  currentClub?: string
  totalWins: number
  totalLosses: number
}
