"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { Alert, AlertTitle, AlertDescription } from "@open-mercato/ui/primitives/alert";
import { useT } from "@open-mercato/shared/lib/i18n/context";
function DnsDiagnostics({ mapping }) {
  const t = useT();
  if (mapping.status !== "dns_failed") return null;
  return /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
    /* @__PURE__ */ jsx(AlertTitle, { children: t("customer_accounts.domainMapping.dns.diagnostics.title", "DNS configuration issue") }),
    /* @__PURE__ */ jsx(AlertDescription, { children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
      mapping.dnsFailureReason ? /* @__PURE__ */ jsx("p", { children: mapping.dnsFailureReason }) : null,
      mapping.cnameTarget ? /* @__PURE__ */ jsxs("dl", { className: "grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1 text-xs", children: [
        /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: t("customer_accounts.domainMapping.dns.diagnostics.expected", "Expected target") }),
        /* @__PURE__ */ jsx("dd", { className: "font-mono", children: mapping.cnameTarget })
      ] }) : null
    ] }) })
  ] });
}
function TlsDiagnostics({ mapping }) {
  const t = useT();
  if (mapping.status !== "tls_failed") return null;
  return /* @__PURE__ */ jsxs(Alert, { variant: "warning", children: [
    /* @__PURE__ */ jsx(AlertTitle, { children: t("customer_accounts.domainMapping.tls.diagnostics.title", "SSL certificate issue") }),
    /* @__PURE__ */ jsx(AlertDescription, { children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
      mapping.tlsFailureReason ? /* @__PURE__ */ jsx("p", { children: mapping.tlsFailureReason }) : null,
      /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("customer_accounts.domainMapping.tls.diagnostics.retryCount", "Retry attempts: {count}", {
        count: String(mapping.tlsRetryCount)
      }) }),
      /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t(
        "customer_accounts.domainMapping.tls.diagnostics.operatorNote",
        "We are retrying automatically. If this persists, contact platform support \u2014 your DNS is fine, this is on our side."
      ) })
    ] }) })
  ] });
}
export {
  DnsDiagnostics,
  TlsDiagnostics
};
//# sourceMappingURL=Diagnostics.js.map
