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

49 lines
1.3 KiB
TypeScript

import { SponsorshipDetailDTO } from '../types/generated/SponsorshipDetailDTO';
export class SponsorshipDetailViewModel implements SponsorshipDetailDTO {
id: string;
leagueId: string;
leagueName: string;
seasonId: string;
seasonName: string;
constructor(dto: SponsorshipDetailDTO) {
this.id = dto.id;
this.leagueId = dto.leagueId;
this.leagueName = dto.leagueName;
this.seasonId = dto.seasonId;
this.seasonName = dto.seasonName;
}
// Note: The generated DTO is incomplete
// These fields will need to be added when the OpenAPI spec is updated
tier: 'main' | 'secondary' = 'secondary';
status: string = 'active';
amount: number = 0;
currency: string = 'USD';
/** 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);
}
}