import { LeagueMemberDto, DriverDto } from '../dtos'; export class LeagueMemberViewModel implements LeagueMemberDto { driverId: string; driver?: DriverDto; role: string; joinedAt: string; private currentUserId: string; constructor(dto: LeagueMemberDto, currentUserId: string) { Object.assign(this, dto); this.currentUserId = currentUserId; } /** UI-specific: Formatted join date */ get formattedJoinedAt(): string { return new Date(this.joinedAt).toLocaleDateString(); } /** UI-specific: Badge variant for role */ get roleBadgeVariant(): string { switch (this.role) { case 'owner': return 'primary'; case 'admin': return 'secondary'; default: return 'default'; } } /** UI-specific: Whether this member is the owner */ get isOwner(): boolean { return this.role === 'owner'; } /** UI-specific: Whether this is the current user */ get isCurrentUser(): boolean { return this.driverId === this.currentUserId; } }