import 'jugador.dart'; /// Configuración de una partida class ConfigPartida { final bool modoMultimovil; final String categoria; // 'todas' o nombre de categoría final int numImpostores; final bool pistaImpostor; final int? tiempoDebateSegundos; // null = sin límite const ConfigPartida({ this.modoMultimovil = false, this.categoria = 'todas', this.numImpostores = 1, this.pistaImpostor = false, this.tiempoDebateSegundos, }); } /// Fases del juego enum FaseJuego { configuracion, verPalabra, debate, votacion, resultado, adivinanza, // El impostor intenta adivinar la palabra finPartida, } /// Resultado de una ronda de votación class ResultadoVotacion { final String eliminadoId; final String eliminadoNombre; final bool eraImpostor; final Map votos; // votante -> votado const ResultadoVotacion({ required this.eliminadoId, required this.eliminadoNombre, required this.eraImpostor, required this.votos, }); } /// Estado completo de una partida class Partida { final ConfigPartida config; final List jugadores; final String palabraSecreta; final String categoriaReal; FaseJuego fase; int rondaActual; final List historialVotaciones; String? ganador; // 'jugadores' | 'impostores' | null Partida({ required this.config, required this.jugadores, required this.palabraSecreta, required this.categoriaReal, this.fase = FaseJuego.verPalabra, this.rondaActual = 1, List? historialVotaciones, this.ganador, }) : historialVotaciones = historialVotaciones ?? []; List get jugadoresActivos => jugadores.where((j) => !j.eliminado).toList(); List get impostoresActivos => jugadoresActivos.where((j) => j.esImpostor).toList(); List get jugadoresNormalesActivos => jugadoresActivos.where((j) => !j.esImpostor).toList(); int get impostoresTotales => jugadores.where((j) => j.esImpostor).length; }