"use client";

import { createComponentDefinition } from "../../utils/createComponentDefinition";
import { ComponentCategory } from "@/types/component";
import { EntitySearchInputComponent } from "./EntitySearchInputComponent";
import { EntitySearchInputConfigPanel } from "./EntitySearchInputConfigPanel";

/**
 * EntitySearchInput 컴포넌트 정의
 * 모달 기반 엔티티 검색 입력
 */
export const EntitySearchInputDefinition = createComponentDefinition({
  id: "entity-search-input",
  name: "엔티티 검색 입력 (모달)",
  nameEng: "Entity Search Input",
  description: "모달을 통한 엔티티 검색 및 선택 (거래처, 품목 등)",
  category: ComponentCategory.INPUT,
  webType: "entity",
  component: EntitySearchInputComponent,
  defaultConfig: {
    tableName: "customer_mng",
    displayField: "customer_name",
    valueField: "customer_code",
    searchFields: ["customer_name", "customer_code"],
    mode: "combo",
    placeholder: "검색...",
    modalTitle: "검색 및 선택",
    modalColumns: ["customer_code", "customer_name", "address"],
    showAdditionalInfo: false,
    additionalFields: [],
  },
  defaultSize: { width: 300, height: 40 },
  configPanel: EntitySearchInputConfigPanel,
  icon: "Search",
  tags: ["검색", "모달", "엔티티", "거래처", "품목"],
  version: "1.0.0",
  author: "개발팀",
});

// 타입 내보내기
export type { EntitySearchInputConfig } from "./config";

// 컴포넌트 내보내기
export { EntitySearchInputComponent } from "./EntitySearchInputComponent";
export { EntitySearchInputWrapper } from "./EntitySearchInputWrapper";
export { EntitySearchInputRenderer } from "./EntitySearchInputRenderer";
export { EntitySearchModal } from "./EntitySearchModal";
export { useEntitySearch } from "./useEntitySearch";
export type {
  EntitySearchInputProps,
  EntitySearchResult,
  EntitySearchResponse,
} from "./types";

