"use client";

import { createComponentDefinition } from "../../utils/createComponentDefinition";
import { ComponentCategory } from "@/types/component";
import { MailRecipientSelectorComponent } from "./MailRecipientSelectorComponent";
import { MailRecipientSelectorConfigPanel } from "./MailRecipientSelectorConfigPanel";
import type { MailRecipientSelectorConfig } from "./types";

/**
 * MailRecipientSelector 컴포넌트 정의
 * 메일 수신자 선택 컴포넌트 (내부 인원 + 외부 이메일)
 */
export const MailRecipientSelectorDefinition = createComponentDefinition({
  id: "mail-recipient-selector",
  name: "메일 수신자 선택",
  nameEng: "Mail Recipient Selector",
  description: "메일 발송 시 수신자/참조를 선택하는 컴포넌트 (내부 인원 선택 + 외부 이메일 입력)",
  category: ComponentCategory.INPUT,
  webType: "custom" as any,
  component: MailRecipientSelectorComponent,
  defaultConfig: {
    toFieldName: "mailTo",
    ccFieldName: "mailCc",
    showCc: true,
    showInternalSelector: true,
    showExternalInput: true,
    toLabel: "수신자",
    ccLabel: "참조(CC)",
    required: true,
  } as MailRecipientSelectorConfig,
  defaultSize: { width: 400, height: 200 },
  configPanel: MailRecipientSelectorConfigPanel,
  icon: "Mail",
  tags: ["메일", "수신자", "이메일", "선택"],
  version: "1.0.0",
  author: "개발팀",
  documentation: "",
});

// 타입 내보내기
export type { MailRecipientSelectorConfig, Recipient, InternalUser } from "./types";

// 컴포넌트 내보내기
export { MailRecipientSelectorComponent } from "./MailRecipientSelectorComponent";
export { MailRecipientSelectorRenderer } from "./MailRecipientSelectorRenderer";
export { MailRecipientSelectorConfigPanel } from "./MailRecipientSelectorConfigPanel";
