import type {
  IAwardPrizePresenter,
  AwardPrizeResultDTO,
  AwardPrizeViewModel,
} from '@core/payments/application/presenters/IAwardPrizePresenter';

export class AwardPrizePresenter implements IAwardPrizePresenter {
  private result: AwardPrizeViewModel | null = null;

  reset() {
    this.result = null;
  }

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

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

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