"use client";
import { jsx } from "react/jsx-runtime";
import { MessageComposer } from "@open-mercato/ui/backend/messages";
function MessageDetailComposerDialogs(props) {
  return /* @__PURE__ */ jsx(
    MessageComposer,
    {
      variant: "compose",
      messageId: props.id,
      expectedUpdatedAt: props.detail.updatedAt,
      open: props.editOpen && props.detail.isDraft && props.detail.canEditDraft,
      onOpenChange: props.setEditOpen,
      defaultValues: {
        type: props.detail.type,
        recipients: props.detail.recipients.map((recipient) => recipient.userId),
        subject: props.detail.subject,
        body: props.detail.body,
        bodyFormat: props.detail.bodyFormat,
        priority: props.detail.priority,
        visibility: props.detail.visibility ?? "internal",
        sourceEntityType: props.detail.sourceEntityType ?? null,
        sourceEntityId: props.detail.sourceEntityId ?? null,
        externalEmail: props.detail.externalEmail ?? null,
        externalName: props.detail.externalName ?? null,
        attachmentIds: props.attachments?.map((attachment) => attachment.id) ?? []
      },
      onSuccess: () => {
        props.setEditOpen(false);
        void props.onRefresh();
      }
    }
  );
}
export {
  MessageDetailComposerDialogs
};
//# sourceMappingURL=composer-dialogs.js.map
