"use client";

import React from "react";
import { NumberingRuleDesigner } from "@/components/numbering-rule/NumberingRuleDesigner";
import { NumberingRuleComponentConfig } from "./types";

interface NumberingRuleWrapperProps {
  config: NumberingRuleComponentConfig;
  onChange?: (config: NumberingRuleComponentConfig) => void;
  isPreview?: boolean;
  tableName?: string; // 현재 화면의 테이블명
}

export const NumberingRuleWrapper: React.FC<NumberingRuleWrapperProps> = ({
  config,
  onChange,
  isPreview = false,
  tableName,
}) => {
  console.log("📋 NumberingRuleWrapper: 테이블명 전달", { tableName, config });
  
  return (
    <div className="h-full w-full">
      <NumberingRuleDesigner
        maxRules={config.maxRules || 6}
        isPreview={isPreview}
        className="h-full"
        currentTableName={tableName} // 테이블명 전달
      />
    </div>
  );
};

export const NumberingRuleComponent = NumberingRuleWrapper;
