import type { ITeamsLeaderboardPresenter, TeamsLeaderboardViewModel, TeamLeaderboardItemViewModel, SkillLevel, } from '@gridpilot/racing/application/presenters/ITeamsLeaderboardPresenter'; export class TeamsLeaderboardPresenter implements ITeamsLeaderboardPresenter { private viewModel: TeamsLeaderboardViewModel | null = null; present(teams: any[], recruitingCount: number): void { this.viewModel = { teams: teams.map((team) => this.transformTeam(team)), recruitingCount, }; } getViewModel(): TeamsLeaderboardViewModel { if (!this.viewModel) { throw new Error('ViewModel not yet generated. Call present() first.'); } return this.viewModel; } private transformTeam(team: any): TeamLeaderboardItemViewModel { return { id: team.id, name: team.name, memberCount: team.memberCount, rating: team.rating, totalWins: team.totalWins, totalRaces: team.totalRaces, performanceLevel: team.performanceLevel as SkillLevel, isRecruiting: team.isRecruiting, createdAt: team.createdAt, description: team.description, specialization: team.specialization, region: team.region, languages: team.languages, }; } }