import { Course } from './course';


export enum ResultatStatut {
  PROVISOIRE,
  OFFICIEL,
  ANNULE,
  EN_ATTENTE
}

export interface Resultat {
  id: string;
  course: Course;
  /**
   * Ordre d'arrivée des chevaux.
   * The backend returns an array of strings/numbers (cheval numbers);
   * in the UI we normalize them to plain numbers.
   */
  ordreArrivee: string;
  /**
   * Chevaux en dead-heat (ex aequo), represented by their numbers.
   */
  chevauxDeadHeat: number[];
  totalMises: number;
  masseAPartager: number;
  prelevementsLegaux: number;
  statut: ResultatStatut;
  montantRembourse: number;
  montantCagnotte: number;
  adeadHeat: boolean;
  createdAt?: string;
  updatedAt?: string;
}

// API response structure (course may be just an ID in some cases)
export interface ResultatApiResponse {
  id: string | number;
  courseId: string | number;
  ordreArrivee: string;
  courseNom: string;
  courseNumero: number;
  reunionNumero:number;
  hippodromeNom: string;
  statut: ResultatStatut;
  datePublication?: string;
  dateAnnulation?: string;
  dateValidation?: string;
  createdAt?: string;
  updatedAt?: string;
}

// POST payload structure
export interface CreateResultatPayload {
  courseId: number;
  statut: ResultatStatut;
  ordreArrivee: string;
  notes?: string
}
