import { PaymentMethodDTO } from '../dtos/PaymentMethodDTO';
import { InvoiceDTO } from '../dtos/InvoiceDTO';
import { BillingStatsDTO } from '../dtos/BillingStatsDTO';

export interface SponsorBillingViewModel {
  paymentMethods: PaymentMethodDTO[];
  invoices: InvoiceDTO[];
  stats: BillingStatsDTO;
}

export class SponsorBillingPresenter {
  private result: SponsorBillingViewModel | null = null;

  reset() {
    this.result = null;
  }

  present(viewModel: SponsorBillingViewModel) {
    this.result = viewModel;
  }

  getViewModel(): SponsorBillingViewModel | null {
    return this.result;
  }

  get viewModel(): SponsorBillingViewModel {
    if (!this.result) throw new Error('Presenter not presented');
    return this.result;
  }
}
