import { Handle, Position } from "@xyflow/react";
import type { NodeProps } from "@xyflow/react";
import type { DiagramNode } from "../graph";
import { HIDDEN_HANDLE } from "../architecture/constants";

export function FlowDecisionNode({ data }: NodeProps) {
  const d = data as unknown as DiagramNode & { label: string };

  return (
    <div className="flow-decision">
      <div
        className="flow-decision-diamond"
        style={d.color ? { borderColor: d.color } : undefined}
      >
        <span className="flow-decision-label">{d.label}</span>
      </div>
      <Handle type="target" position={Position.Top} style={HIDDEN_HANDLE} />
      <Handle
        type="target"
        position={Position.Left}
        id="left"
        style={HIDDEN_HANDLE}
      />
      <Handle
        type="source"
        position={Position.Bottom}
        style={HIDDEN_HANDLE}
      />
      <Handle
        type="source"
        position={Position.Right}
        id="right"
        style={HIDDEN_HANDLE}
      />
    </div>
  );
}
