import type {
  IGetPrizesPresenter,
  GetPrizesResultDTO,
  GetPrizesViewModel,
} from '@core/payments/application/presenters/IGetPrizesPresenter';

export class GetPrizesPresenter implements IGetPrizesPresenter {
  private result: GetPrizesViewModel | null = null;

  reset() {
    this.result = null;
  }

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

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

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