import type {
  IProcessWalletTransactionPresenter,
  ProcessWalletTransactionResultDTO,
  ProcessWalletTransactionViewModel,
} from '@core/payments/application/presenters/IProcessWalletTransactionPresenter';

export class ProcessWalletTransactionPresenter implements IProcessWalletTransactionPresenter {
  private result: ProcessWalletTransactionViewModel | null = null;

  reset() {
    this.result = null;
  }

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

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

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