import { CreateLeagueWithSeasonAndScoringResult } from '@core/racing/application/use-cases/CreateLeagueWithSeasonAndScoringUseCase';
import type { CreateLeagueViewModel } from '../dtos/CreateLeagueDTO';

export class CreateLeaguePresenter {
  private result: CreateLeagueViewModel | null = null;

  reset() {
    this.result = null;
  }

  present(dto: CreateLeagueWithSeasonAndScoringResult): void {
    this.result = {
      leagueId: dto.league.id.toString(),
      success: true,
    };
  }

  getViewModel(): CreateLeagueViewModel {
    if (!this.result) throw new Error('Presenter not presented');
    return this.result;
  }
}