"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import * as React from "react";
import { CalendarClock, Phone, FileText, EyeOff } from "lucide-react";
import { cn } from "@open-mercato/shared/lib/utils";
import { useT } from "@open-mercato/shared/lib/i18n/context";
import { Button } from "@open-mercato/ui/primitives/button";
import { IconButton } from "@open-mercato/ui/primitives/icon-button";
import { Tooltip, TooltipContent, TooltipTrigger } from "@open-mercato/ui/primitives/tooltip";
function NextStepCard({ nextInteractionAt, nextInteractionName, onHide }) {
  const t = useT();
  const daysUntil = React.useMemo(() => {
    if (!nextInteractionAt) return null;
    const diff = new Date(nextInteractionAt).getTime() - Date.now();
    return Math.ceil(diff / 864e5);
  }, [nextInteractionAt]);
  if (!nextInteractionAt) {
    return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-card p-5", children: [
      /* @__PURE__ */ jsxs("h3", { className: "flex items-center gap-2 text-sm font-semibold text-foreground", children: [
        /* @__PURE__ */ jsx(CalendarClock, { className: "size-4" }),
        t("customers.companies.detail.nextStep.title", "Next Step")
      ] }),
      /* @__PURE__ */ jsx("p", { className: "mt-3 text-sm text-muted-foreground", children: t("customers.companies.detail.nextStep.none", "No upcoming interactions scheduled") })
    ] });
  }
  const isOverdue = daysUntil !== null && daysUntil < 0;
  const countdownText = daysUntil !== null ? daysUntil === 0 ? t("customers.companies.detail.nextStep.today", "today") : daysUntil > 0 ? t("customers.companies.detail.nextStep.in", "in {days} days", { days: daysUntil }) : t("customers.companies.detail.nextStep.overdue", "{days} days overdue", { days: Math.abs(daysUntil) }) : null;
  return /* @__PURE__ */ jsxs("div", { className: "group relative rounded-lg border bg-card p-5", children: [
    /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxs("h3", { className: "flex items-center gap-2 text-sm font-semibold text-foreground", children: [
        /* @__PURE__ */ jsx(CalendarClock, { className: "size-4" }),
        t("customers.companies.detail.nextStep.title", "Next Step")
      ] }),
      onHide && /* @__PURE__ */ jsx(
        IconButton,
        {
          type: "button",
          variant: "ghost",
          size: "xs",
          onClick: onHide,
          className: "opacity-0 transition-opacity group-hover:opacity-60",
          "aria-label": t("customers.companies.dashboard.hideTile", "Hide tile"),
          children: /* @__PURE__ */ jsx(EyeOff, { className: "size-3.5" })
        }
      )
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "mt-3", children: [
      /* @__PURE__ */ jsx("p", { className: "font-semibold text-foreground", children: nextInteractionName || t("customers.companies.detail.nextStep.untitled", "Scheduled interaction") }),
      countdownText && /* @__PURE__ */ jsx("p", { className: cn("mt-1 text-sm", isOverdue ? "font-medium text-destructive" : "text-muted-foreground"), children: countdownText })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center gap-2", children: [
      /* @__PURE__ */ jsxs(Tooltip, { children: [
        /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", size: "sm", className: "h-7 text-xs", disabled: true, children: [
          /* @__PURE__ */ jsx(Phone, { className: "mr-1 size-3" }),
          t("customers.companies.detail.nextStep.call", "Call")
        ] }) }),
        /* @__PURE__ */ jsx(TooltipContent, { children: t("customers.ai.comingSoon", "Coming soon") })
      ] }),
      /* @__PURE__ */ jsxs(Tooltip, { children: [
        /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", size: "sm", className: "h-7 text-xs", disabled: true, children: [
          /* @__PURE__ */ jsx(FileText, { className: "mr-1 size-3" }),
          t("customers.companies.detail.nextStep.proposal", "Proposal")
        ] }) }),
        /* @__PURE__ */ jsx(TooltipContent, { children: t("customers.ai.comingSoon", "Coming soon") })
      ] })
    ] })
  ] });
}
export {
  NextStepCard
};
//# sourceMappingURL=NextStepCard.js.map
