53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
import { SponsorshipDetailDTO } from '../types/generated/SponsorshipDetailDTO';
|
|
|
|
export class SponsorshipDetailViewModel {
|
|
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';
|
|
type: string = 'league';
|
|
entityName: string = '';
|
|
price: number = 0;
|
|
impressions: number = 0;
|
|
|
|
/** 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);
|
|
}
|
|
} |