import { DriverStatsDTO } from '../dtos/DriverStatsDTO';
import type { ITotalDriversPresenter, TotalDriversResultDTO } from '../../../../../core/racing/application/presenters/ITotalDriversPresenter';

export class DriverStatsPresenter implements ITotalDriversPresenter {
  private result: DriverStatsDTO | null = null;

  reset() {
    this.result = null;
  }

  present(dto: TotalDriversResultDTO) {
    this.result = {
      totalDrivers: dto.totalDrivers,
    };
  }

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