import type {
  IsDriverRegisteredForRaceResult,
} from '@core/racing/application/use-cases/IsDriverRegisteredForRaceUseCase';
import { DriverRegistrationStatusDTO } from '../dtos/DriverRegistrationStatusDTO';

export class DriverRegistrationStatusPresenter {
  private responseModel: DriverRegistrationStatusDTO | null = null;

  reset(): void {
    this.responseModel = null;
  }

  present(result: IsDriverRegisteredForRaceResult): void {
    this.responseModel = {
      isRegistered: result.isRegistered,
      raceId: result.raceId,
      driverId: result.driverId,
    };
  }

  getResponseModel(): DriverRegistrationStatusDTO {
    if (!this.responseModel) throw new Error('Presenter not presented');
    return this.responseModel;
  }
}
