package tech.easyflow.ai.node;

import com.alibaba.fastjson.JSONObject;
import com.easyagents.flow.core.node.BaseNode;
import com.easyagents.flow.core.parser.BaseNodeParser;
import tech.easyflow.common.constant.enums.EnumResourceType;

public class DownloadNodeParser extends BaseNodeParser {

    @Override
    protected BaseNode doParse(JSONObject root, JSONObject data, JSONObject tinyflow) {
        Integer resourceType = data.getInteger("resourceType");
        if (resourceType == null) {
            resourceType = EnumResourceType.OTHER.getCode();
        }
        return new DownloadNode(resourceType);
    }

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