"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import Link from "next/link";
import { Button } from "../ui/button.js";
import { ArrowLeft } from "lucide-react";
function EntityPageHeader({
  entityConfig,
  mode,
  data,
  actions,
  className
}) {
  const Icon = entityConfig.icon;
  const getTitle = () => {
    switch (mode) {
      case "create":
        return `Crear ${entityConfig.names.singular}`;
      case "edit":
        return typeof (data == null ? void 0 : data.title) === "string" ? data.title : typeof (data == null ? void 0 : data.name) === "string" ? data.name : `Editar ${entityConfig.names.singular}`;
      case "view":
      default:
        return typeof (data == null ? void 0 : data.title) === "string" ? data.title : typeof (data == null ? void 0 : data.name) === "string" ? data.name : entityConfig.names.singular;
    }
  };
  const getSubtitle = () => {
    switch (mode) {
      case "create":
        return `Nuevo ${entityConfig.names.singular.toLowerCase()}`;
      case "edit":
        return `Editando ${entityConfig.names.singular.toLowerCase()} \u2022 ID: ${typeof (data == null ? void 0 : data.id) === "string" ? data.id : "N/A"}`;
      case "view":
      default:
        return `${entityConfig.names.singular} \u2022 ID: ${typeof (data == null ? void 0 : data.id) === "string" ? data.id : "N/A"}`;
    }
  };
  return /* @__PURE__ */ jsxs("div", { className: `space-y-6 ${className || ""}`, children: [
    /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Link, { href: `/dashboard/${entityConfig.slug}`, children: /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", children: [
      /* @__PURE__ */ jsx(ArrowLeft, { className: "h-4 w-4 mr-2" }),
      "Volver a ",
      entityConfig.names.plural
    ] }) }) }),
    /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsxs("h1", { className: "text-3xl font-bold tracking-tight flex items-center gap-2", children: [
          /* @__PURE__ */ jsx(Icon, { className: "h-8 w-8" }),
          getTitle()
        ] }),
        /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: getSubtitle() })
      ] }),
      actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: actions })
    ] })
  ] });
}
export {
  EntityPageHeader
};
