import type {
  ICreatePrizePresenter,
  CreatePrizeResultDTO,
  CreatePrizeViewModel,
} from '@core/payments/application/presenters/ICreatePrizePresenter';

export class CreatePrizePresenter implements ICreatePrizePresenter {
  private result: CreatePrizeViewModel | null = null;

  reset() {
    this.result = null;
  }

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

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

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