Files
gridpilot.gg/apps/website/lib/view-models/SponsorshipDetailViewModel.ts
2025-12-17 18:01:47 +01:00

41 lines
1.0 KiB
TypeScript

import { SponsorshipDetailDto } from '../dtos';
export class SponsorshipDetailViewModel implements SponsorshipDetailDto {
id: string;
leagueId: string;
leagueName: string;
seasonId: string;
tier: 'main' | 'secondary';
status: string;
amount: number;
currency: string;
constructor(dto: SponsorshipDetailDto) {
Object.assign(this, dto);
}
/** UI-specific: Formatted amount */
get formattedAmount(): string {
return `${this.currency} ${this.amount.toLocaleString()}`;
}
/** UI-specific: Tier badge variant */
get tierBadgeVariant(): string {
return this.tier === 'main' ? 'primary' : 'secondary';
}
/** UI-specific: Status color */
get statusColor(): string {
switch (this.status) {
case 'active': return 'green';
case 'pending': return 'yellow';
case 'expired': return 'red';
default: return 'gray';
}
}
/** UI-specific: Status display */
get statusDisplay(): string {
return this.status.charAt(0).toUpperCase() + this.status.slice(1);
}
}