62 lines
1.7 KiB
TypeScript
62 lines
1.7 KiB
TypeScript
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
import { CurrencyFormatter } from "../formatters/CurrencyFormatter";
|
|
import type { SponsorshipDetailViewData } from "../view-data/SponsorshipDetailViewData";
|
|
|
|
export class SponsorshipDetailViewModel extends ViewModel {
|
|
id: string;
|
|
leagueId: string;
|
|
leagueName: string;
|
|
seasonId: string;
|
|
seasonName: string;
|
|
tier: 'main' | 'secondary';
|
|
status: string;
|
|
amount: number;
|
|
currency: string;
|
|
type: string;
|
|
entityName: string;
|
|
price: number;
|
|
impressions: number;
|
|
|
|
constructor(data: SponsorshipDetailViewData) {
|
|
super();
|
|
this.id = data.id;
|
|
this.leagueId = data.leagueId;
|
|
this.leagueName = data.leagueName;
|
|
this.seasonId = data.seasonId;
|
|
this.seasonName = data.seasonName;
|
|
this.tier = data.tier;
|
|
this.status = data.status;
|
|
this.amount = data.amount;
|
|
this.currency = data.currency;
|
|
this.type = data.type;
|
|
this.entityName = data.entityName;
|
|
this.price = data.price;
|
|
this.impressions = data.impressions;
|
|
}
|
|
|
|
/** UI-specific: Formatted amount */
|
|
get formattedAmount(): string {
|
|
return CurrencyFormatter.format(this.amount, this.currency);
|
|
}
|
|
|
|
/** 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);
|
|
}
|
|
}
|