import type { AgendaDurationStep, AgendaTimeFormat, AgendaWeekStart } from "@/lib/agenda/agenda-settings-types"
import { AGENDA_QUICK_DURATION_OPTIONS, AGENDA_VIDEO_PROVIDER_LABELS } from "@/lib/agenda/agenda-settings-types"

export function formatDurationStepLabel(step: AgendaDurationStep): string {
  return step === 60 ? "1 h" : `${step} min`
}

export function formatQuickDurationLabel(minutes: number): string {
  const preset = AGENDA_QUICK_DURATION_OPTIONS.find((o) => o.minutes === minutes)
  if (preset) return preset.label
  if (minutes % 60 === 0) return minutes === 60 ? "1 h" : `${minutes / 60} h`
  return `${minutes} min`
}

export function formatTimeFormatLabel(format: AgendaTimeFormat): string {
  return format === "12h" ? "AM / PM" : "24 h"
}

export function formatWeekStartLabel(value: AgendaWeekStart): string {
  switch (value) {
    case "auto":
      return "Automatique (locale)"
    case 0:
      return "Dimanche"
    case 1:
      return "Lundi"
    case 6:
      return "Samedi"
    default:
      return "Automatique (locale)"
  }
}

export function videoProviderLabel(provider: keyof typeof AGENDA_VIDEO_PROVIDER_LABELS): string {
  return AGENDA_VIDEO_PROVIDER_LABELS[provider]
}
