import type {
  IUpdateMemberPaymentPresenter,
  UpdateMemberPaymentResultDTO,
  UpdateMemberPaymentViewModel,
} from '@core/payments/application/presenters/IUpdateMemberPaymentPresenter';

export class UpdateMemberPaymentPresenter implements IUpdateMemberPaymentPresenter {
  private result: UpdateMemberPaymentViewModel | null = null;

  reset() {
    this.result = null;
  }

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

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

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