"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { Mail, Phone, User as UserIcon } from "lucide-react";
import { useT } from "@open-mercato/shared/lib/i18n/context";
import { Avatar } from "../../primitives/avatar.js";
import { KeyValueList, RecordCardShell, TagRow, statusToTagVariant } from "./RecordCardShell.js";
function PersonCard(props) {
  const t = useT();
  const status = props.status ? { label: props.status, variant: statusToTagVariant(props.status) } : null;
  const items = [
    props.title ? { label: t("ai_assistant.chat.records.fields.title", "Title"), value: props.title } : null,
    props.companyName ? { label: t("ai_assistant.chat.records.fields.company", "Company"), value: props.companyName } : null,
    props.email ? {
      label: t("ai_assistant.chat.records.fields.email", "Email"),
      value: /* @__PURE__ */ jsx(
        "a",
        {
          href: `mailto:${props.email}`,
          className: "text-primary hover:underline",
          onClick: (event) => event.stopPropagation(),
          children: props.email
        }
      )
    } : null,
    props.phone ? {
      label: t("ai_assistant.chat.records.fields.phone", "Phone"),
      value: /* @__PURE__ */ jsx(
        "a",
        {
          href: `tel:${props.phone.replace(/\s+/g, "")}`,
          className: "text-primary hover:underline",
          onClick: (event) => event.stopPropagation(),
          children: props.phone
        }
      )
    } : null,
    props.ownerName ? { label: t("ai_assistant.chat.records.fields.owner", "Owner"), value: props.ownerName } : null
  ].filter(Boolean);
  const subtitle = [props.title, props.companyName].filter(Boolean).join(" \u2022 ");
  return /* @__PURE__ */ jsx(
    RecordCardShell,
    {
      kindLabel: t("ai_assistant.chat.records.kinds.person", "Person"),
      kindIcon: /* @__PURE__ */ jsx(UserIcon, { className: "size-4", "aria-hidden": true }),
      leading: /* @__PURE__ */ jsx(Avatar, { label: props.name, src: props.avatarUrl ?? void 0, size: "md" }),
      title: props.name,
      subtitle: subtitle || void 0,
      status,
      href: props.href,
      id: props.id,
      className: props.className,
      dataKind: "person",
      children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
        /* @__PURE__ */ jsx(KeyValueList, { items }),
        props.tags && props.tags.length > 0 ? /* @__PURE__ */ jsx(TagRow, { tags: props.tags }) : null
      ] })
    }
  );
}
var PersonCard_default = PersonCard;
export {
  Mail,
  PersonCard,
  Phone,
  UserIcon,
  PersonCard_default as default
};
//# sourceMappingURL=PersonCard.js.map
