import type {
  ICreatePaymentPresenter,
  CreatePaymentResultDTO,
  CreatePaymentViewModel,
} from '@core/payments/application/presenters/ICreatePaymentPresenter';

export class CreatePaymentPresenter implements ICreatePaymentPresenter {
  private result: CreatePaymentViewModel | null = null;

  reset() {
    this.result = null;
  }

  present(dto: CreatePaymentResultDTO) {
    this.result = dto;
  }

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

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