import type {
  IUpsertMembershipFeePresenter,
  UpsertMembershipFeeResultDTO,
  UpsertMembershipFeeViewModel,
} from '@core/payments/application/presenters/IUpsertMembershipFeePresenter';

export class UpsertMembershipFeePresenter implements IUpsertMembershipFeePresenter {
  private result: UpsertMembershipFeeViewModel | null = null;

  reset() {
    this.result = null;
  }

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

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

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