"use client";

import { memo } from "react";
import { NodeProps } from "reactflow";
import { Terminal } from "lucide-react";
import { CompactNodeShell } from "./CompactNodeShell";

export const ScriptActionNode = memo(({ data, selected }: NodeProps<any>) => {
  const scriptType = data.scriptType || "python";
  const summary = data.inlineScript
    ? `${scriptType} 스크립트 (${data.inlineScript.split("\n").length}줄)`
    : "스크립트를 작성해 주세요";

  return (
    <CompactNodeShell
      color="#10B981"
      label={data.displayName || "스크립트 실행"}
      summary={summary}
      icon={<Terminal className="h-3.5 w-3.5" />}
      selected={selected}
    >
      {data.scriptType && (
        <span className="rounded bg-emerald-500/20 px-1 py-0.5 font-mono text-[9px] font-semibold text-emerald-400">
          {scriptType}
        </span>
      )}
    </CompactNodeShell>
  );
});

ScriptActionNode.displayName = "ScriptActionNode";
