"use client";

import { createComponentDefinition } from "../../utils/createComponentDefinition";
import { ComponentCategory } from "@/types/component";
import { AggregationWidgetWrapper } from "./AggregationWidgetComponent";
import { AggregationWidgetConfigPanel } from "./AggregationWidgetConfigPanel";
import type { AggregationWidgetConfig } from "./types";

/**
 * AggregationWidget 컴포넌트 정의
 * 데이터 집계 (합계, 평균, 개수 등)를 표시하는 위젯
 */
export const AggregationWidgetDefinition = createComponentDefinition({
  id: "aggregation-widget",
  name: "집계 위젯",
  nameEng: "Aggregation Widget",
  description: "데이터의 합계, 평균, 개수 등 집계 결과를 표시하는 위젯",
  category: ComponentCategory.DISPLAY,
  webType: "text",
  component: AggregationWidgetWrapper,
  defaultConfig: {
    dataSourceType: "manual",
    items: [],
    layout: "horizontal",
    showLabels: true,
    showIcons: true,
    gap: "16px",
    backgroundColor: "#f8fafc",
    borderRadius: "6px",
    padding: "12px",
  } as Partial<AggregationWidgetConfig>,
  defaultSize: { width: 400, height: 60 },
  configPanel: AggregationWidgetConfigPanel,
  icon: "Calculator",
  tags: ["집계", "합계", "평균", "개수", "통계", "데이터"],
  version: "1.0.0",
  author: "개발팀",
  hidden: true, // v2-aggregation-widget 사용으로 패널에서 숨김
});

// 타입 내보내기
export type { AggregationWidgetConfig, AggregationItem, AggregationType, AggregationResult } from "./types";

