"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 { DealForm } from "./DealForm.js";
import { useT } from "@open-mercato/shared/lib/i18n/context";
function DealDialog({
  open,
  mode,
  onOpenChange,
  initialValues,
  onSubmit,
  isSubmitting,
  titles,
  submitLabels,
  cancelLabel
}) {
  const t = useT();
  const dialogTitle = mode === "edit" ? titles?.edit ?? t("customers.people.detail.deals.editTitle", "Edit deal") : titles?.create ?? t("customers.people.detail.deals.addTitle", "Add deal");
  const resolvedSubmitLabel = mode === "edit" ? submitLabels?.edit ?? t("customers.people.detail.deals.update", "Update deal (\u2318/Ctrl + Enter)") : submitLabels?.create ?? t("customers.people.detail.deals.save", "Save deal (\u2318/Ctrl + Enter)");
  const resolvedCancelLabel = cancelLabel ?? t("customers.people.detail.deals.cancel", "Cancel");
  const handleCancel = React.useCallback(() => {
    onOpenChange(false);
  }, [onOpenChange]);
  return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-4xl w-full", children: [
    /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: dialogTitle }) }),
    /* @__PURE__ */ jsx(
      DealForm,
      {
        mode,
        initialValues,
        onSubmit,
        onCancel: handleCancel,
        submitLabel: resolvedSubmitLabel,
        cancelLabel: resolvedCancelLabel,
        isSubmitting
      }
    )
  ] }) });
}
var DealDialog_default = DealDialog;
export {
  DealDialog,
  DealDialog_default as default
};
//# sourceMappingURL=DealDialog.js.map
