"use client";

import { memo } from "react";
import { NodeProps } from "reactflow";
import { Trash2 } from "lucide-react";
import { CompactNodeShell } from "./CompactNodeShell";
import type { DeleteActionNodeData } from "@/types/node-editor";

export const DeleteActionNode = memo(({ data, selected }: NodeProps<DeleteActionNodeData>) => {
  const whereCount = data.whereConditions?.length || 0;
  const summary = data.targetTable
    ? `${data.targetTable} (${whereCount}개 조건)`
    : "대상 테이블을 선택해 주세요";

  return (
    <CompactNodeShell
      color="#EF4444"
      label={data.displayName || "DELETE"}
      summary={summary}
      icon={<Trash2 className="h-3.5 w-3.5" />}
      selected={selected}
    />
  );
});

DeleteActionNode.displayName = "DeleteActionNode";
