"use client";

import { createComponentDefinition } from "../../utils/createComponentDefinition";
import { ComponentCategory } from "@/types/component";
import { AutocompleteSearchInputComponent } from "./AutocompleteSearchInputComponent";
import { AutocompleteSearchInputConfigPanel } from "./AutocompleteSearchInputConfigPanel";

/**
 * AutocompleteSearchInput 컴포넌트 정의
 * 자동완성 드롭다운 방식의 엔티티 검색 입력
 */
export const AutocompleteSearchInputDefinition = createComponentDefinition({
  id: "autocomplete-search-input",
  name: "자동완성 검색 입력",
  nameEng: "Autocomplete Search Input",
  description: "타이핑하면 드롭다운이 나타나는 엔티티 검색 입력 (거래처, 사용자 등)",
  category: ComponentCategory.INPUT,
  webType: "entity",
  component: AutocompleteSearchInputComponent,
  defaultConfig: {
    tableName: "customer_mng",
    displayField: "customer_name",
    valueField: "customer_code",
    searchFields: ["customer_name", "customer_code"],
    placeholder: "검색...",
    showAdditionalInfo: false,
    additionalFields: [],
  },
  defaultSize: { width: 300, height: 40 },
  configPanel: AutocompleteSearchInputConfigPanel,
  icon: "Search",
  tags: ["검색", "자동완성", "엔티티", "드롭다운", "거래처"],
  version: "1.0.0",
  author: "개발팀",
});

// 타입 내보내기
export type { AutocompleteSearchInputConfig } from "./types";

// 컴포넌트 내보내기
export { AutocompleteSearchInputComponent } from "./AutocompleteSearchInputComponent";
export { AutocompleteSearchInputRenderer } from "./AutocompleteSearchInputRenderer";

