import type {
  IUpdatePaymentStatusPresenter,
  UpdatePaymentStatusResultDTO,
  UpdatePaymentStatusViewModel,
} from '@core/payments/application/presenters/IUpdatePaymentStatusPresenter';

export class UpdatePaymentStatusPresenter implements IUpdatePaymentStatusPresenter {
  private result: UpdatePaymentStatusViewModel | null = null;

  reset() {
    this.result = null;
  }

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

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

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