export type MeetTranscriptionMode = "live" | "queued"

export type MeetTranscriptionEngine = "faster_whisper_local" | "external_api"

export type MeetExternalAPIProvider =
  | "openai_compatible"
  | "deepgram"
  | "google"
  | "custom"

export type MeetEmailRecipients = "organizer" | "participants" | "both" | "custom"

export type MeetPostActionsSettings = {
  email_enabled: boolean
  email_recipients: MeetEmailRecipients
  email_custom_addresses: string
  drive_enabled: boolean
  drive_folder_path: string
  llm_enabled: boolean
  llm_provider_id: string
  llm_prompt: string
  llm_then_email: boolean
  llm_then_drive: boolean
}

export type MeetOrgPolicySettings = {
  transcription_enabled: boolean
  transcription_mode: MeetTranscriptionMode
  transcription_engine: MeetTranscriptionEngine
  skynet_url: string
  whisper_model: string
  external_api_url: string
  external_api_provider: MeetExternalAPIProvider
  external_api_key: string
  auto_start_transcription: boolean
  post_actions: MeetPostActionsSettings
}

export const MEET_TRANSCRIPTION_MODE_LABELS: Record<MeetTranscriptionMode, string> = {
  live: "Temps réel (sous-titres pendant la réunion)",
  queued: "Différé (transcription après la réunion)",
}

export const MEET_TRANSCRIPTION_ENGINE_LABELS: Record<MeetTranscriptionEngine, string> = {
  faster_whisper_local: "Faster Whisper (Skynet local)",
  external_api: "API externe (OpenAI-compatible, Deepgram, etc.)",
}

export const MEET_EXTERNAL_API_PROVIDER_LABELS: Record<MeetExternalAPIProvider, string> = {
  openai_compatible: "OpenAI-compatible (Whisper API)",
  deepgram: "Deepgram",
  google: "Google Cloud Speech-to-Text",
  custom: "Personnalisé",
}

export const MEET_EMAIL_RECIPIENTS_LABELS: Record<MeetEmailRecipients, string> = {
  organizer: "Organisateur uniquement",
  participants: "Participants",
  both: "Organisateur et participants",
  custom: "Adresses personnalisées",
}

export const DEFAULT_MEET_POST_ACTIONS: MeetPostActionsSettings = {
  email_enabled: false,
  email_recipients: "organizer",
  email_custom_addresses: "",
  drive_enabled: true,
  drive_folder_path: "/UltiMeet/Transcripts",
  llm_enabled: false,
  llm_provider_id: "",
  llm_prompt:
    "Résume cette réunion en français : points clés, décisions et actions à suivre.",
  llm_then_email: true,
  llm_then_drive: true,
}

export const DEFAULT_MEET_POLICY: MeetOrgPolicySettings = {
  transcription_enabled: false,
  transcription_mode: "live",
  transcription_engine: "faster_whisper_local",
  skynet_url: "http://skynet:8000",
  whisper_model: "tiny",
  external_api_url: "",
  external_api_provider: "openai_compatible",
  external_api_key: "",
  auto_start_transcription: false,
  post_actions: DEFAULT_MEET_POST_ACTIONS,
}
