/**
 * Calcule le statut d'un événement en fonction de sa date
 * @param eventDate La date de l'événement
 * @returns Le statut calculé (PAST, LIVE, ou UPCOMING)
 */
export function calculateEventStatus(
  eventDate: Date | string
): "UPCOMING" | "LIVE" | "PAST" {
  const date = typeof eventDate === "string" ? new Date(eventDate) : eventDate;
  const now = new Date();

  // Normaliser les dates à minuit UTC pour comparer uniquement les jours
  const eventDateOnly = new Date(
    Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate())
  );

  const todayOnly = new Date(
    Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate())
  );

  if (eventDateOnly < todayOnly) {
    return "PAST";
  } else if (eventDateOnly.getTime() === todayOnly.getTime()) {
    return "LIVE";
  } else {
    return "UPCOMING";
  }
}
