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

37 lines
1021 B
TypeScript

import { MembershipFeeDto } from '../types/generated/MembershipFeeDto';
export class MembershipFeeViewModel implements MembershipFeeDto {
id: string;
leagueId: string;
constructor(dto: MembershipFeeDto) {
this.id = dto.id;
this.leagueId = dto.leagueId;
}
// Note: The generated DTO is incomplete
// These fields will need to be added when the OpenAPI spec is updated
amount: number = 0;
currency: string = 'USD';
period: string = 'monthly';
/** UI-specific: Formatted amount */
get formattedAmount(): string {
return `${this.currency} ${this.amount.toFixed(2)}`;
}
/** UI-specific: Period display */
get periodDisplay(): string {
switch (this.period) {
case 'monthly': return 'Monthly';
case 'yearly': return 'Yearly';
case 'season': return 'Per Season';
default: return this.period;
}
}
/** UI-specific: Amount per period */
get amountPerPeriod(): string {
return `${this.formattedAmount} ${this.periodDisplay.toLowerCase()}`;
}
}