/** * Simulator Registry * * Maps a sport's simulatorType to the appropriate Simulator implementation. * Set simulatorType on the sport record in the admin UI. * Add new simulators here as new sports are supported. */ import type { Simulator } from "./types"; import { BracketSimulator } from "./bracket-simulator"; import { F1Simulator } from "./f1-simulator"; import { GolfSimulator } from "./golf-simulator"; import { UCLSimulator } from "./ucl-simulator"; import { NCAAMSimulator } from "./ncaam-simulator"; import { NCAAWSimulator } from "./ncaaw-simulator"; export type SimulatorType = | "f1_standings" | "indycar_standings" | "golf_qualifying_points" | "playoff_bracket" | "ucl_bracket" | "ncaam_bracket" | "ncaaw_bracket"; export interface SimulatorInfo { name: string; description: string; } const REGISTRY: Record Simulator }> = { f1_standings: { info: { name: "F1 Standings Model", description: "Simulates remaining races using current F1 standings and futures odds" }, create: () => new F1Simulator(), }, indycar_standings: { info: { name: "IndyCar Standings Model", description: "Simulates remaining races using current IndyCar standings and futures odds" }, create: () => new F1Simulator(), }, golf_qualifying_points: { info: { name: "Qualifying Points Model", description: "Simulates remaining majors using current QP standings and futures odds" }, create: () => new GolfSimulator(), }, playoff_bracket: { info: { name: "Bracket Monte Carlo", description: "Simulates playoff bracket outcomes using Elo ratings" }, create: () => new BracketSimulator(), }, ucl_bracket: { info: { name: "UCL Bracket Monte Carlo", description: "Simulates the UEFA Champions League 16-team knockout bracket using blended Elo + futures odds" }, create: () => new UCLSimulator(), }, ncaam_bracket: { info: { name: "NCAAM Bracket Monte Carlo", description: "Simulates the NCAA Men's Basketball Tournament 64-team bracket using KenPom net ratings" }, create: () => new NCAAMSimulator(), }, ncaaw_bracket: { info: { name: "NCAAW Bracket Monte Carlo", description: "Simulates the NCAA Women's Basketball Tournament 64-team bracket using Barttorvik Barthag ratings" }, create: () => new NCAAWSimulator(), }, }; export function getSimulator(simulatorType: SimulatorType): Simulator { const entry = REGISTRY[simulatorType]; if (!entry) { throw new Error( `No simulator registered for type: "${simulatorType}". ` + `Add a simulator to app/services/simulations/registry.ts.` ); } return entry.create(); } export function getSimulatorInfo(simulatorType: SimulatorType): SimulatorInfo | null { return REGISTRY[simulatorType]?.info ?? null; }