import type { TeamStats } from '@adapters/bootstrap/racing/RacingTeamFactory'; /** * Global store for team stats that can be populated during seeding * and read by the AllTeamsPresenter */ export class TeamStatsStore { private static instance: TeamStatsStore; private statsMap = new Map(); private constructor() {} static getInstance(): TeamStatsStore { if (!TeamStatsStore.instance) { TeamStatsStore.instance = new TeamStatsStore(); } return TeamStatsStore.instance; } /** * Populate the store with stats (called during seeding) */ loadStats(stats: Map): void { this.statsMap.clear(); stats.forEach((input, teamId) => { this.statsMap.set(teamId, input); }); } /** * Get stats for a specific team */ getTeamStats(teamId: string): TeamStats | null { return this.statsMap.get(teamId) ?? null; } /** * Clear all stats (useful for reseeding) */ clear(): void { this.statsMap.clear(); } /** * Get all stats (for debugging) */ getAllStats(): Map { return new Map(this.statsMap); } }