package tech.easyflow.ai.node;

import com.alibaba.fastjson.JSONObject;
import com.easyagents.flow.core.node.BaseNode;
import com.easyagents.flow.core.parser.BaseNodeParser;

public class WorkflowNodeParser extends BaseNodeParser {

    @Override
    protected BaseNode doParse(JSONObject root, JSONObject data, JSONObject tinyflow) {
        String workflowId = data.getString("workflowId");
        if (workflowId == null) {
            throw new RuntimeException("请选择工作流");
        }
        return new WorkflowNode(workflowId);
    }

    public String getNodeName() {
        return "workflow-node";
    }
}
