import type {
  IGetWalletPresenter,
  GetWalletResultDTO,
  GetWalletViewModel,
} from '@core/payments/application/presenters/IGetWalletPresenter';

export class GetWalletPresenter implements IGetWalletPresenter {
  private result: GetWalletViewModel | null = null;

  reset() {
    this.result = null;
  }

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

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

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