"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { ShieldX, ArrowLeft, Home } from "lucide-react";
import { Button } from "../ui/button.js";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../ui/card.js";
import Link from "next/link";
import { useRouter } from "next/navigation";
function NoPermission({
  entityName,
  action = "list",
  title,
  description,
  showBackButton = true,
  showHomeButton = true,
  redirectPath = "/dashboard"
}) {
  const router = useRouter();
  const getActionText = () => {
    switch (action) {
      case "list":
        return "ver la lista de";
      case "read":
        return "ver los detalles de";
      case "create":
        return "crear";
      case "update":
        return "editar";
      case "delete":
        return "eliminar";
      default:
        return "acceder a";
    }
  };
  const defaultTitle = title || "Acceso denegado";
  const defaultDescription = description || (entityName ? `No tienes permisos para ${getActionText()} ${entityName}. Contacta a tu administrador si necesitas acceso.` : "No tienes permisos para acceder a esta secci\xF3n. Contacta a tu administrador si necesitas acceso.");
  return /* @__PURE__ */ jsx(
    "div",
    {
      className: "min-h-screen bg-gradient-to-b from-background to-muted/20 py-12 px-4 sm:px-6 lg:px-8",
      "data-cy": "permission-denied",
      children: /* @__PURE__ */ jsx("div", { className: "max-w-md mx-auto", children: /* @__PURE__ */ jsxs(Card, { className: "border-destructive/20", children: [
        /* @__PURE__ */ jsxs(CardHeader, { className: "text-center", children: [
          /* @__PURE__ */ jsx("div", { className: "mx-auto w-16 h-16 rounded-full bg-destructive/10 flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx(ShieldX, { className: "h-8 w-8 text-destructive" }) }),
          /* @__PURE__ */ jsx(CardTitle, { className: "text-xl", "data-cy": "permission-denied-title", children: defaultTitle }),
          /* @__PURE__ */ jsx(CardDescription, { className: "text-base", "data-cy": "permission-denied-description", children: defaultDescription })
        ] }),
        /* @__PURE__ */ jsxs(CardContent, { className: "flex flex-col gap-3", children: [
          showBackButton && /* @__PURE__ */ jsxs(
            Button,
            {
              variant: "outline",
              onClick: () => router.back(),
              className: "w-full",
              children: [
                /* @__PURE__ */ jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }),
                "Volver atr\xE1s"
              ]
            }
          ),
          showHomeButton && /* @__PURE__ */ jsx(Button, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsxs(Link, { href: redirectPath, children: [
            /* @__PURE__ */ jsx(Home, { className: "mr-2 h-4 w-4" }),
            "Ir al Dashboard"
          ] }) })
        ] })
      ] }) })
    }
  );
}
var NoPermission_default = NoPermission;
export {
  NoPermission,
  NoPermission_default as default
};
