// Note: No generated DTO available for Media yet interface MediaDTO { id: string; url: string; type: 'image' | 'video' | 'document'; category?: 'avatar' | 'team-logo' | 'league-cover' | 'race-result'; uploadedAt: Date; size?: number; } /** * Media View Model * * Represents media information for the UI layer */ export class MediaViewModel { id: string; url: string; type: 'image' | 'video' | 'document'; category?: 'avatar' | 'team-logo' | 'league-cover' | 'race-result'; uploadedAt: Date; size?: number; constructor(dto: MediaDTO) { this.id = dto.id; this.url = dto.url; this.type = dto.type; this.uploadedAt = dto.uploadedAt; if (dto.category !== undefined) this.category = dto.category; if (dto.size !== undefined) this.size = dto.size; } /** UI-specific: Formatted file size */ get formattedSize(): string { if (!this.size) return 'Unknown'; const kb = this.size / 1024; if (kb < 1024) return `${kb.toFixed(2)} KB`; const mb = kb / 1024; return `${mb.toFixed(2)} MB`; } }