"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { useTranslations } from "next-intl";
import { AlertTriangle } from "lucide-react";
import { Alert, AlertDescription, AlertTitle } from "../ui/alert.js";
import { Button } from "../ui/button.js";
function DowngradeWarning({
  overLimitResources,
  onConfirm,
  onCancel
}) {
  const t = useTranslations("billing.downgrade");
  if (overLimitResources.length === 0) {
    return null;
  }
  return /* @__PURE__ */ jsxs(Alert, { variant: "destructive", className: "mb-4", "data-cy": "downgrade-warning", children: [
    /* @__PURE__ */ jsx(AlertTriangle, { className: "h-4 w-4" }),
    /* @__PURE__ */ jsx(AlertTitle, { "data-cy": "downgrade-warning-title", children: t("title") }),
    /* @__PURE__ */ jsxs(AlertDescription, { children: [
      /* @__PURE__ */ jsx("p", { className: "mb-2", "data-cy": "downgrade-warning-description", children: t("description") }),
      /* @__PURE__ */ jsx(
        "ul",
        {
          className: "list-disc list-inside space-y-1 mb-3",
          "data-cy": "downgrade-warning-list",
          children: overLimitResources.map((resource) => /* @__PURE__ */ jsx("li", { "data-cy": `downgrade-limit-${resource.limitSlug}`, children: t("resource_over", {
            resource: resource.limitSlug,
            current: resource.currentCount,
            limit: resource.newLimit
          }) }, resource.limitSlug))
        }
      ),
      /* @__PURE__ */ jsx(
        "p",
        {
          className: "mt-2 text-sm text-muted-foreground",
          "data-cy": "downgrade-warning-policy",
          children: t("policy")
        }
      ),
      /* @__PURE__ */ jsxs("div", { className: "flex gap-2 mt-4", children: [
        /* @__PURE__ */ jsx(
          Button,
          {
            variant: "destructive",
            onClick: onConfirm,
            "data-cy": "downgrade-warning-confirm",
            children: t("confirm")
          }
        ),
        /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: onCancel, "data-cy": "downgrade-warning-cancel", children: t("cancel") })
      ] })
    ] })
  ] });
}
export {
  DowngradeWarning
};
