import { PaymentDto } from '../dtos';

export class PaymentViewModel implements PaymentDto {
  id: string;
  amount: number;
  currency: string;
  status: string;
  createdAt: string;

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

  /** UI-specific: Formatted amount */
  get formattedAmount(): string {
    return `${this.currency} ${this.amount.toFixed(2)}`;
  }

  /** UI-specific: Status color */
  get statusColor(): string {
    switch (this.status) {
      case 'completed': return 'green';
      case 'pending': return 'yellow';
      case 'failed': return 'red';
      default: return 'gray';
    }
  }

  /** UI-specific: Formatted created date */
  get formattedCreatedAt(): string {
    return new Date(this.createdAt).toLocaleString();
  }

  /** UI-specific: Status display */
  get statusDisplay(): string {
    return this.status.charAt(0).toUpperCase() + this.status.slice(1);
  }
}