"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { Bell, Eye, ChevronDown } from "lucide-react";
import { useT } from "@open-mercato/shared/lib/i18n/context";
import { isVisible, getFieldLabel } from "./fieldConfig.js";
const REMINDER_OPTIONS = [0, 5, 10, 15, 30, 60, 240, 1440];
function formatReminderLabel(minutes, t) {
  if (minutes === 0) return t("customers.schedule.reminder.none", "None");
  if (minutes >= 1440) {
    const days = Math.round(minutes / 1440);
    return days === 1 ? t("customers.schedule.reminder.dayBefore", "1 day before") : t("customers.schedule.reminder.daysBefore", "{days} days before", { days });
  }
  if (minutes >= 60) {
    const hours = Math.round(minutes / 60);
    return hours === 1 ? t("customers.schedule.reminder.hourBefore", "1 hour before") : t("customers.schedule.reminder.hoursBefore", "{hours} hours before", { hours });
  }
  return t("customers.schedule.reminder.minutesBefore", "{minutes} min before", { minutes });
}
function FooterFields({
  visible,
  activityType,
  reminderMinutes,
  setReminderMinutes,
  visibility,
  setVisibility
}) {
  const t = useT();
  const showReminder = isVisible(activityType, "reminder");
  const showVisibility = isVisible(activityType, "visibility");
  if (!showReminder && !showVisibility) return null;
  return /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
    showReminder && /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-1.5", children: [
      /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold text-muted-foreground tracking-wider", children: getFieldLabel(activityType, "reminder", t, "customers.schedule.reminder", "Reminder") }),
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2.5", children: [
        /* @__PURE__ */ jsx(Bell, { className: "size-3.5 text-muted-foreground" }),
        /* @__PURE__ */ jsx(
          "select",
          {
            value: reminderMinutes,
            onChange: (e) => setReminderMinutes(Number(e.target.value)),
            className: "flex-1 appearance-none bg-transparent text-sm text-foreground focus:outline-none",
            children: REMINDER_OPTIONS.map((m) => /* @__PURE__ */ jsx("option", { value: m, children: formatReminderLabel(m, t) }, m))
          }
        ),
        /* @__PURE__ */ jsx(ChevronDown, { className: "size-3.5 text-muted-foreground" })
      ] })
    ] }),
    showVisibility && /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-1.5", children: [
      /* @__PURE__ */ jsx("label", { className: "text-overline font-semibold text-muted-foreground tracking-wider", children: getFieldLabel(activityType, "visibility", t, "customers.schedule.visibility", "Visibility") }),
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2.5", children: [
        /* @__PURE__ */ jsx(Eye, { className: "size-3.5 text-muted-foreground" }),
        /* @__PURE__ */ jsxs(
          "select",
          {
            value: visibility,
            onChange: (e) => setVisibility(e.target.value),
            className: "flex-1 appearance-none bg-transparent text-sm text-foreground focus:outline-none",
            children: [
              /* @__PURE__ */ jsx("option", { value: "team", children: t("customers.schedule.visibility.team", "Team only") }),
              /* @__PURE__ */ jsx("option", { value: "public", children: t("customers.schedule.visibility.public", "Public") })
            ]
          }
        ),
        /* @__PURE__ */ jsx(ChevronDown, { className: "size-3.5 text-muted-foreground" })
      ] })
    ] })
  ] });
}
export {
  FooterFields
};
//# sourceMappingURL=FooterFields.js.map
