import type { SponsorDashboardDto } from '../dtos';

/**
 * Sponsor Dashboard View Model
 *
 * View model for sponsor dashboard data with UI-specific transformations.
 */
export class SponsorDashboardViewModel implements SponsorDashboardDto {
  sponsorId: string;
  sponsorName: string;
  totalSponsorships: number;
  activeSponsorships: number;
  totalInvestment: number;

  constructor(dto: SponsorDashboardDto) {
    Object.assign(this, dto);
  }

  /** UI-specific: Formatted total investment */
  get formattedTotalInvestment(): string {
    return `$${this.totalInvestment.toLocaleString()}`;
  }

  /** UI-specific: Active percentage */
  get activePercentage(): number {
    if (this.totalSponsorships === 0) return 0;
    return Math.round((this.activeSponsorships / this.totalSponsorships) * 100);
  }

  /** UI-specific: Has sponsorships */
  get hasSponsorships(): boolean {
    return this.totalSponsorships > 0;
  }

  /** UI-specific: Status text */
  get statusText(): string {
    if (this.activeSponsorships === 0) return 'No active sponsorships';
    if (this.activeSponsorships === this.totalSponsorships) return 'All sponsorships active';
    return `${this.activeSponsorships} of ${this.totalSponsorships} active`;
  }
}