import { ViewModel } from "../contracts/view-models/ViewModel"; import { NumberFormatter } from "../formatters/NumberFormatter"; import { RatingFormatter } from "../formatters/RatingFormatter"; import type { DriverSummaryData } from "../view-data/DriverSummaryData"; /** * View Model for driver summary with rating and rank * * Client-only UI helper built from ViewData. */ export class DriverSummaryViewModel extends ViewModel { constructor(private readonly viewData: DriverSummaryData) { super(); } get id(): string { return this.viewData.driverId; } get name(): string { return this.viewData.driverName; } get avatarUrl(): string | null { return this.viewData.avatarUrl; } get rating(): number | null { return this.viewData.rating; } get ratingLabel(): string { return RatingFormatter.format(this.rating); } get rank(): number | null { return this.viewData.rank; } get rankLabel(): string { return this.rank === null ? '—' : NumberFormatter.format(this.rank); } get roleBadgeText(): string { return this.viewData.roleBadgeText; } get roleBadgeClasses(): string { return this.viewData.roleBadgeClasses; } get profileUrl(): string { return this.viewData.profileUrl; } }