import { jsxs as r, jsx as t } from "react/jsx-runtime";
import { Link as C } from "react-router-dom";
import { Check as k, Crown as P, Star as h, Users as j, Link2 as A, UserCheck as b, ArrowRight as S, Trash2 as T } from "lucide-react";
import { useTranslation as $ } from "react-i18next";
import { u as G, g as I, a as D } from "./tenantIconMap-DKmj47wO.js";
function L(e, c) {
  const o = D(e);
  return /* @__PURE__ */ t(o, { className: c });
}
const f = {
  Pending: {
    bg: "var(--info-bg)",
    text: "var(--info-text)",
    dot: "var(--info-dot)"
  },
  Active: {
    bg: "var(--success-bg)",
    text: "var(--success-text)",
    dot: "var(--success-dot)"
  },
  Suspended: {
    bg: "var(--warning-bg)",
    text: "var(--warning-text)",
    dot: "var(--warning-dot)"
  },
  Archived: {
    bg: "var(--error-bg)",
    text: "var(--error-text)",
    dot: "var(--error-dot)"
  }
};
function _({
  tenant: e,
  isSelected: c = !1,
  isDisabled: o = !1,
  disabledReason: l,
  onSelect: d,
  onSetDefault: m,
  onEnter: u,
  onManage: M,
  onRemove: x,
  showActions: N = !0,
  navigateTo: p
}) {
  const { t: a } = $("navigation"), { getIconForType: y } = G(), i = e.status === "Active", n = f[e.status] || f.Active, w = N && !o, g = y(e.type), v = I(g.color);
  return /* @__PURE__ */ r(
    "div",
    {
      className: `group relative bg-[var(--bg-card)] border overflow-hidden transition-all duration-200 ${c ? "border-emerald-500 ring-2 ring-emerald-500/20" : "border-[var(--border-color)] hover:border-[var(--color-accent-300)]"} ${i ? "" : "opacity-60"} ${o ? "opacity-50 grayscale" : ""} rounded-[var(--radius-card)]`,
      title: o && l ? l : void 0,
      children: [
        /* @__PURE__ */ r("div", { className: "p-5", children: [
          /* @__PURE__ */ r("div", { className: "flex items-start justify-between mb-4", children: [
            /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
              /* @__PURE__ */ t("div", { className: `w-12 h-12 rounded-xl flex items-center justify-center ${v.bg}`, children: L(g.icon, `w-6 h-6 ${v.text}`) }),
              /* @__PURE__ */ r("div", { children: [
                /* @__PURE__ */ t("h3", { className: "font-semibold text-[var(--text-primary)] line-clamp-1", children: p ? /* @__PURE__ */ t(
                  C,
                  {
                    to: p,
                    className: "hover:text-[var(--color-accent-600)] hover:underline transition-colors",
                    onClick: (s) => s.stopPropagation(),
                    children: e.name
                  }
                ) : e.name }),
                /* @__PURE__ */ t("p", { className: "text-sm text-[var(--text-tertiary)]", children: e.slug })
              ] })
            ] }),
            c && /* @__PURE__ */ t("div", { className: "w-6 h-6 rounded-full bg-emerald-500 flex items-center justify-center", children: /* @__PURE__ */ t(k, { className: "w-4 h-4 text-white" }) })
          ] }),
          e.organisationName && /* @__PURE__ */ t("p", { className: "text-sm text-[var(--text-secondary)] mb-3 line-clamp-1", children: e.organisationName }),
          /* @__PURE__ */ r("div", { className: "flex items-center gap-2 flex-wrap mb-4", children: [
            /* @__PURE__ */ r(
              "span",
              {
                className: "inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full",
                style: { backgroundColor: n.bg, color: n.text },
                children: [
                  /* @__PURE__ */ t(
                    "span",
                    {
                      className: "w-1.5 h-1.5 rounded-full",
                      style: { backgroundColor: n.dot }
                    }
                  ),
                  a(`tenants.status.${e.status.toLowerCase()}`, { defaultValue: e.status })
                ]
              }
            ),
            e.isOwner && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-amber-500/10 text-amber-600", children: [
              /* @__PURE__ */ t(P, { className: "w-3 h-3" }),
              a("tenants.owner", "Owner")
            ] }),
            e.isDefault && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-[var(--color-accent-500)]/10 text-[var(--color-accent-600)]", children: [
              /* @__PURE__ */ t(h, { className: "w-3 h-3 fill-current" }),
              a("tenants.default", "Default")
            ] })
          ] }),
          e.membershipSource && e.membershipSource !== "Direct" && /* @__PURE__ */ r("div", { className: "mb-4 p-2 rounded-lg bg-[var(--bg-secondary)] border border-[var(--border-subtle)]", children: [
            /* @__PURE__ */ r("div", { className: "flex items-center gap-2 mb-1", children: [
              e.membershipSource === "Group" ? /* @__PURE__ */ t(j, { className: "w-3.5 h-3.5 text-blue-500" }) : /* @__PURE__ */ t(A, { className: "w-3.5 h-3.5 text-violet-500" }),
              /* @__PURE__ */ t("span", { className: "text-xs font-medium text-[var(--text-secondary)]", children: e.membershipSource === "Group" ? a("tenants.viaGroup", "Via groupe") : a("tenants.directAndGroup", "Direct + Groupe") })
            ] }),
            (e.groupPaths?.length ?? 0) > 0 && /* @__PURE__ */ r("div", { className: "mt-1 space-y-1", children: [
              e.groupPaths?.slice(0, 2).map((s) => /* @__PURE__ */ r("div", { className: "text-xs text-[var(--text-tertiary)] flex items-center gap-1", children: [
                /* @__PURE__ */ t(b, { className: "w-3 h-3" }),
                /* @__PURE__ */ t("span", { className: "truncate", title: s.lineage, children: s.lineage })
              ] }, s.lineage)),
              (e.groupPaths?.length ?? 0) > 2 && /* @__PURE__ */ r("span", { className: "text-xs text-[var(--text-tertiary)]", children: [
                "+",
                (e.groupPaths?.length ?? 0) - 2,
                " ",
                a("common.more", "autres")
              ] })
            ] })
          ] }),
          e.membershipSource === "Direct" && /* @__PURE__ */ r("div", { className: "mb-4 flex items-center gap-1.5 text-xs text-[var(--text-tertiary)]", children: [
            /* @__PURE__ */ t(b, { className: "w-3.5 h-3.5 text-green-500" }),
            a("tenants.directMember", "Membre direct")
          ] }),
          w && /* @__PURE__ */ r("div", { className: "flex items-center gap-2 pt-3 border-t border-[var(--border-color)]", children: [
            !e.isDefault && i && m && /* @__PURE__ */ t(
              "button",
              {
                onClick: (s) => {
                  s.stopPropagation(), m();
                },
                className: "flex items-center justify-center px-3 py-2 text-[var(--text-secondary)] hover:text-amber-500 hover:bg-[var(--bg-tertiary)] transition-colors rounded-[var(--radius-button)]",
                title: a("tenants.setDefault", "Set default"),
                children: /* @__PURE__ */ t(h, { className: "w-4 h-4" })
              }
            ),
            i && u && /* @__PURE__ */ r(
              "button",
              {
                onClick: (s) => {
                  s.stopPropagation(), u();
                },
                className: "flex items-center justify-center gap-1.5 px-4 py-2 text-sm font-medium text-white bg-[var(--color-accent-500)] hover:bg-[var(--color-accent-600)] transition-colors rounded-[var(--radius-button)]",
                children: [
                  a("tenants.enter", "Enter"),
                  /* @__PURE__ */ t(S, { className: "w-4 h-4" })
                ]
              }
            ),
            x && /* @__PURE__ */ t(
              "button",
              {
                onClick: (s) => {
                  s.stopPropagation(), x();
                },
                className: "flex items-center justify-center gap-1.5 px-3 py-2 text-sm font-medium text-[var(--error-text)] hover:bg-[var(--error-bg)] transition-colors rounded-[var(--radius-button)]",
                title: a("tenants.remove", "Retirer"),
                children: /* @__PURE__ */ t(T, { className: "w-4 h-4" })
              }
            )
          ] })
        ] }),
        d && i && /* @__PURE__ */ t(
          "button",
          {
            onClick: d,
            className: "absolute inset-0 z-10",
            "aria-label": a("tenants.select", "Select tenant")
          }
        )
      ]
    }
  );
}
export {
  _ as T
};
//# sourceMappingURL=TenantCard-B2SOvtZs.js.map
