// AUTO-GENERATED — do not edit by hand
// Upstream: https://github.com/n8n-io/n8n/blob/master/packages/nodes-base/nodes/ExecuteWorkflow/ExecuteWorkflow/ExecuteWorkflow.node.ts
// To implement: copy to ../impl/executeworkflow.rs, fill in execute(), add to ../impl/mod.rs
// r8r: rust port of n8n.io
// License: Unlicense

use async_trait::async_trait;
use crate::core::error::NodeError;
use crate::core::types::*;
use crate::engine::{ExecuteCtx, Node, NodeFactory};
use std::sync::Arc;

pub struct ExecuteworkflowNode;

static META: NodeMetadata = NodeMetadata {
    name: "executeworkflow",
    display_name: "Execute Sub-workflow",
    version: &[1],
    group: &["transform"],
    description: "Execute another workflow",
    inputs: 1,
    outputs: 1,
    properties: &[
    PropertyDef { name: "operation", display_name: "Operation", kind: PropertyKind::String, required: false, default: Some("call_workflow") },
    PropertyDef { name: "outdatedVersionWarning", display_name: "This node is out of date. Please upgrade by removing it and adding a new one", kind: PropertyKind::Notice, required: false, default: Some("") },
    PropertyDef { name: "source", display_name: "Source", kind: PropertyKind::Options, required: false, default: Some("database") },
    PropertyDef { name: "source", display_name: "Source", kind: PropertyKind::Options, required: false, default: Some("database") },
    PropertyDef { name: "workflowId", display_name: "Workflow ID", kind: PropertyKind::String, required: true, default: Some("") },
    PropertyDef { name: "workflowId", display_name: "Workflow", kind: PropertyKind::String, required: true, default: Some("") },
    PropertyDef { name: "workflowPath", display_name: "Workflow Path", kind: PropertyKind::String, required: true, default: Some("") },
    PropertyDef { name: "workflowJson", display_name: "Workflow JSON", kind: PropertyKind::Json, required: true, default: Some("\\n\\n\\n") },
    PropertyDef { name: "workflowUrl", display_name: "Workflow URL", kind: PropertyKind::String, required: true, default: Some("") },
    PropertyDef { name: "executeWorkflowNotice", display_name: "Any data you pass into this node will be output by the Execute Workflow Trigger. <a href=", kind: PropertyKind::Notice, required: false, default: Some("") },
    PropertyDef { name: "workflowInputs", display_name: "Workflow Inputs", kind: PropertyKind::String, required: true, default: None },
    PropertyDef { name: "mode", display_name: "Mode", kind: PropertyKind::Options, required: false, default: Some("once") },
    PropertyDef { name: "options", display_name: "Options", kind: PropertyKind::Collection, required: false, default: None }
],
    credentials: &[],
};

#[async_trait]
impl Node for ExecuteworkflowNode {
    fn metadata(&self) -> &'static NodeMetadata { &META }

    async fn execute(&self, _ctx: &mut ExecuteCtx<'_>) -> Result<NodeOutput, NodeError> {
    Err(NodeError::NotYetPorted { node: "executeworkflow", upstream: "https://github.com/n8n-io/n8n/blob/master/packages/nodes-base/nodes/ExecuteWorkflow/ExecuteWorkflow/ExecuteWorkflow.node.ts" })
    }
}

inventory::submit! { NodeFactory::new("executeworkflow", || Arc::new(ExecuteworkflowNode)) }
