import type { IRaceRegistrationRepository } from '../../domain/repositories/IRaceRegistrationRepository'; import type { IsDriverRegisteredForRaceQueryParamsDTO } from '../dto/RaceRegistrationQueryDTO'; import type { IDriverRegistrationStatusPresenter } from '../presenters/IDriverRegistrationStatusPresenter'; import type { UseCase } from '@gridpilot/shared/application/UseCase'; /** * Use Case: IsDriverRegisteredForRaceUseCase * * Checks if a driver is registered for a specific race. * Orchestrates domain logic and delegates presentation to the presenter. */ export class IsDriverRegisteredForRaceUseCase implements UseCase { constructor(private readonly registrationRepository: IRaceRegistrationRepository) {} async execute(params: IsDriverRegisteredForRaceQueryParamsDTO, presenter: IDriverRegistrationStatusPresenter): Promise { presenter.reset(); const { raceId, driverId } = params; const isRegistered = await this.registrationRepository.isRegistered(raceId, driverId); presenter.present(isRegistered, raceId, driverId); } }