import { ViewModel } from "../contracts/view-models/ViewModel"; import { CurrencyDisplay } from "../display-objects/CurrencyDisplay"; import { DateDisplay } from "../display-objects/DateDisplay"; import type { SponsorshipRequestViewData } from "../view-data/SponsorshipRequestViewData"; export class SponsorshipRequestViewModel extends ViewModel { id: string; sponsorId: string; sponsorName: string; sponsorLogo?: string; tier: 'main' | 'secondary'; offeredAmount: number; currency: string; formattedAmount: string; message?: string; createdAt: Date; platformFee: number; netAmount: number; constructor(data: SponsorshipRequestViewData) { super(); this.id = data.id; this.sponsorId = data.sponsorId; this.sponsorName = data.sponsorName; this.sponsorLogo = data.sponsorLogo; this.tier = data.tier; this.offeredAmount = data.offeredAmount; this.currency = data.currency; this.formattedAmount = data.formattedAmount; this.message = data.message; this.createdAt = new Date(data.createdAt); this.platformFee = data.platformFee; this.netAmount = data.netAmount; } /** UI-specific: Formatted date */ get formattedDate(): string { return DateDisplay.formatMonthDay(this.createdAt); } /** UI-specific: Net amount in dollars */ get netAmountDollars(): string { return CurrencyDisplay.format(this.netAmount / 100, 'USD'); } /** UI-specific: Tier display */ get tierDisplay(): string { return this.tier === 'main' ? 'Main Sponsor' : 'Secondary'; } /** UI-specific: Tier badge variant */ get tierBadgeVariant(): 'primary' | 'secondary' { return this.tier === 'main' ? 'primary' : 'secondary'; } }