"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import * as React from "react";
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@open-mercato/ui/primitives/dialog";
import { ActivityForm } from "./ActivityForm.js";
import { useT } from "@open-mercato/shared/lib/i18n/context";
function ActivityDialog({
  open,
  mode,
  onOpenChange,
  initialValues,
  onSubmit,
  isSubmitting,
  activityTypeLabels,
  loadActivityOptions,
  createActivityOption,
  titles,
  submitLabels,
  cancelLabel,
  dealOptions,
  entityOptions,
  defaultEntityId
}) {
  const t = useT();
  const dialogTitle = mode === "edit" ? titles?.edit ?? t("customers.people.detail.activities.editTitle", "Edit activity") : titles?.create ?? t("customers.people.detail.activities.addTitle", "Add activity");
  const resolvedSubmitLabel = mode === "edit" ? submitLabels?.edit ?? t("customers.people.detail.activities.update", "Update activity (\u2318/Ctrl + Enter)") : submitLabels?.create ?? t("customers.people.detail.activities.save", "Save activity (\u2318/Ctrl + Enter)");
  const resolvedCancelLabel = cancelLabel ?? t("customers.people.detail.activities.cancel", "Cancel");
  const handleCancel = React.useCallback(() => {
    onOpenChange(false);
  }, [onOpenChange]);
  return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-3xl", children: [
    /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: dialogTitle }) }),
    /* @__PURE__ */ jsx(
      ActivityForm,
      {
        mode,
        initialValues,
        onSubmit,
        onCancel: handleCancel,
        submitLabel: resolvedSubmitLabel,
        cancelLabel: resolvedCancelLabel,
        isSubmitting,
        activityTypeLabels,
        loadActivityOptions,
        createActivityOption,
        dealOptions,
        entityOptions,
        defaultEntityId
      }
    )
  ] }) });
}
export {
  ActivityDialog
};
//# sourceMappingURL=ActivityDialog.js.map
