// Note: No generated DTO available for TeamMember yet interface DriverDTO { id: string; name: string; avatarUrl?: string; iracingId?: string; rating?: number; } interface TeamMemberDTO { driverId: string; driver?: DriverDTO; role: string; joinedAt: string; } export class TeamMemberViewModel { driverId: string; driver?: any; role: string; joinedAt: string; private currentUserId: string; private teamOwnerId: string; constructor(dto: TeamMemberDTO, currentUserId: string, teamOwnerId: string) { Object.assign(this, dto); this.currentUserId = currentUserId; this.teamOwnerId = teamOwnerId; } /** UI-specific: Role badge variant */ get roleBadgeVariant(): string { switch (this.role) { case 'owner': return 'primary'; case 'captain': return 'secondary'; case 'member': return 'default'; default: return 'default'; } } /** UI-specific: Whether this member is the owner */ get isOwner(): boolean { return this.driverId === this.teamOwnerId; } /** UI-specific: Whether current user can manage this member */ get canManage(): boolean { return this.currentUserId === this.teamOwnerId && this.driverId !== this.currentUserId; } /** UI-specific: Whether this is the current user */ get isCurrentUser(): boolean { return this.driverId === this.currentUserId; } /** UI-specific: Formatted joined date */ get formattedJoinedAt(): string { return new Date(this.joinedAt).toLocaleDateString(); } }