import { LeagueStandingsRepository, RawStanding } from '@core/league/application/ports/LeagueStandingsRepository'; import { Logger } from '@core/shared/domain'; export class InMemoryLeagueStandingsRepository implements LeagueStandingsRepository { private standings: Map = new Map(); // Key: leagueId constructor(private readonly logger: Logger) { this.logger.info('InMemoryLeagueStandingsRepository initialized.'); } async getLeagueStandings(leagueId: string): Promise { this.logger.debug(`[InMemoryLeagueStandingsRepository] Getting standings for league: ${leagueId}.`); const leagueStandings = this.standings.get(leagueId) ?? []; this.logger.info(`Found ${leagueStandings.length} standings for league: ${leagueId}.`); return Promise.resolve(leagueStandings); } // Helper method for seeding/updating if needed by other in-memory repos public setLeagueStandings(leagueId: string, standings: RawStanding[]): void { this.standings.set(leagueId, standings); this.logger.debug(`[InMemoryLeagueStandingsRepository] Set standings for league: ${leagueId}.`); } }