// r8r: rust port of n8n.io
// Initial author: Michael Cochran <mcochran@cochranblock.org>
// Built for: Tanner Woodrum, intended cofounder
// License: Unlicense (public domain dedication, see 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 NoOpNode;

static META: NodeMetadata = NodeMetadata {
    name: "no_op",
    display_name: "No Operation",
    version: &[1],
    group: &["transform"],
    description: "Pass items through unchanged. Useful for organizing workflows.",
    inputs: 1,
    outputs: 1,
    properties: &[],
    credentials: &[],
};

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

    async fn execute(&self, ctx: &mut ExecuteCtx<'_>) -> Result<NodeOutput, NodeError> {
        Ok(vec![ctx.input.clone()])
    }
}

inventory::submit! { NodeFactory::new("no_op", || Arc::new(NoOpNode)) }
