import { longDateFr } from "./format";

export const CHANNELS = ["instagram", "facebook", "wyylde"] as const;
export type Channel = (typeof CHANNELS)[number];

export type PublicationStatus = "published" | "manual" | "error" | "skipped";

export const CHANNEL_LABEL: Record<Channel, string> = {
  instagram: "Instagram",
  facebook: "Facebook",
  wyylde: "Wyylde",
};

type CaptionSource = {
  title: string;
  description: string | null;
  event_date: string;
  time_label: string | null;
};

/** Légende par défaut, partagée par les trois réseaux (modifiable dans l'admin). */
export function buildCaption(ev: CaptionSource): string {
  const lines = [
    `${ev.title.toUpperCase()} — ${longDateFr(ev.event_date)}${ev.time_label ? `, ${ev.time_label}` : ""}`,
  ];
  if (ev.description) lines.push(ev.description);
  lines.push("Le Vesper · 13 rue Forville, Cannes · Réservation : +33 6 66 36 58 19");
  lines.push("#Cannes #LeVesper #VesperCannes");
  return lines.join("\n\n");
}
