"use client";

import { ComponentRegistry } from "../../ComponentRegistry";
import { ComponentCategory } from "@/types/component";
import { TableSearchContainerWrapper } from "./TableSearchContainerWrapper";
import { TableSearchWidgetRenderer } from "./TableSearchWidgetRenderer";
import { V2TableSearchWidgetConfigPanel } from "@/components/v2/config-panels/V2TableSearchWidgetConfigPanel";

// 검색 필터 위젯 등록 (v2)
ComponentRegistry.registerComponent({
  id: "v2-table-search-widget",
  name: "검색 필터",
  name_eng: "Table Search Widget",
  category: ComponentCategory.UTILITY,
  description: "화면 내 테이블을 자동 감지하여 검색, 필터, 그룹 기능을 제공하는 위젯",
  icon: "Search",
  tags: ["table", "search", "filter", "group", "search-widget"],
  web_type: "custom" as any,
  default_size: { width: 1920, height: 80 }, // 픽셀 단위: 전체 너비 × 80px 높이
  component: TableSearchContainerWrapper as any,
  renderer: TableSearchWidgetRenderer.render as any,
  config_panel: V2TableSearchWidgetConfigPanel,
  version: "1.0.0",
  author: "Invyone",
  // ─── INVYONE DataPort 선언 ───
  dataPorts: {
    outputs: [{ name: "searchParams", type: "params" }],
  },
  // ★ 2026-04-11: 통합 `search` 컴포넌트로 흡수됨. 팔레트에서 숨김.
  //   기존 저장 화면의 v2-table-search-widget 은 계속 렌더되지만, 신규 배치는 `search`.
  hidden: true,
} as any);

export { TableSearchWidget } from "./TableSearchWidget";
export { TableSearchWidgetRenderer } from "./TableSearchWidgetRenderer";
export { TableSearchWidgetConfigPanel } from "./TableSearchWidgetConfigPanel";

