Files
gridpilot.gg/apps/website/lib/view-models/ProtestViewModel.ts
2026-01-24 01:07:43 +01:00

38 lines
1.6 KiB
TypeScript

import { DateFormatter } from '@/lib/formatters/DateFormatter';
import { StatusFormatter } from '@/lib/formatters/StatusFormatter';
import type { ProtestViewData } from "@/lib/view-data/ProtestViewData";
import { ViewModel } from "../contracts/view-models/ViewModel";
export class ProtestViewModel extends ViewModel {
private readonly data: ProtestViewData;
constructor(data: ProtestViewData) {
super();
this.data = data;
}
get id(): string { return this.data.id; }
get raceId(): string { return this.data.raceId; }
get protestingDriverId(): string { return this.data.protestingDriverId; }
get accusedDriverId(): string { return this.data.accusedDriverId; }
get description(): string { return this.data.description; }
get submittedAt(): string { return this.data.submittedAt; }
get filedAt(): string | undefined { return this.data.filedAt; }
get status(): string { return this.data.status; }
get reviewedAt(): string | undefined { return this.data.reviewedAt; }
get decisionNotes(): string | undefined { return this.data.decisionNotes; }
get incident(): { lap?: number; description?: string } | null | undefined { return this.data.incident; }
get proofVideoUrl(): string | null | undefined { return this.data.proofVideoUrl; }
get comment(): string | null | undefined { return this.data.comment; }
/** UI-specific: Formatted submitted date */
get formattedSubmittedAt(): string {
return DateFormatter.formatShort(this.submittedAt);
}
/** UI-specific: Status display */
get statusDisplay(): string {
return StatusFormatter.protestStatus(this.status);
}
}