import { BaseApiClient } from '../base/BaseApiClient';
import { RacePenaltiesDTO } from '../../types/generated/RacePenaltiesDTO';
import { ApplyPenaltyCommandDTO } from '../../types/generated/ApplyPenaltyCommandDTO';
import type { PenaltyTypesReferenceDTO } from '../../types/PenaltyTypesReferenceDTO';

/**
 * Penalties API Client
 *
 * Handles all penalty-related API operations.
 */
export class PenaltiesApiClient extends BaseApiClient {
  /** Get penalties for a race */
  getRacePenalties(raceId: string): Promise<RacePenaltiesDTO> {
    return this.get<RacePenaltiesDTO>(`/races/${raceId}/penalties`);
  }

  /** Get allowed penalty types and semantics */
  getPenaltyTypesReference(): Promise<PenaltyTypesReferenceDTO> {
    return this.get<PenaltyTypesReferenceDTO>('/races/reference/penalty-types');
  }

  /** Apply a penalty */
  applyPenalty(input: ApplyPenaltyCommandDTO): Promise<void> {
    return this.post<void>('/races/penalties/apply', input);
  }
}