import type { DriversLeaderboardDTO } from '@/lib/types/generated/DriversLeaderboardDTO'; import type { DriversViewData } from '@/lib/types/view-data/DriversViewData'; import { RatingDisplay } from '@/lib/display-objects/RatingDisplay'; import { NumberDisplay } from '@/lib/display-objects/NumberDisplay'; export class DriversViewDataBuilder { static build(dto: DriversLeaderboardDTO): DriversViewData { return { drivers: dto.drivers.map(driver => ({ id: driver.id, name: driver.name, rating: driver.rating, ratingLabel: RatingDisplay.format(driver.rating), skillLevel: driver.skillLevel, category: driver.category, nationality: driver.nationality, racesCompleted: driver.racesCompleted, wins: driver.wins, podiums: driver.podiums, isActive: driver.isActive, rank: driver.rank, avatarUrl: driver.avatarUrl, })), totalRaces: dto.totalRaces, totalRacesLabel: NumberDisplay.format(dto.totalRaces), totalWins: dto.totalWins, totalWinsLabel: NumberDisplay.format(dto.totalWins), activeCount: dto.activeCount, activeCountLabel: NumberDisplay.format(dto.activeCount), totalDriversLabel: NumberDisplay.format(dto.drivers.length), }; } }