// AUTO-GENERATED — do not edit by hand
// Upstream: https://github.com/n8n-io/n8n/blob/master/packages/@n8n/nodes-langchain/nodes/tools/ToolCode/ToolCode.node.ts
// To implement: copy to ../impl/toolcode.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 ToolcodeNode;

static META: NodeMetadata = NodeMetadata {
    name: "toolcode",
    display_name: "Code Tool",
    version: &[1],
    group: &["transform"],
    description: "Write a tool in JS or Python",
    inputs: 1,
    outputs: 1,
    properties: &[
    PropertyDef { name: "noticeTemplateExample", display_name: "See an example of a conversational agent with custom tool written in JavaScript <a href=", kind: PropertyKind::Notice, required: false, default: Some("") },
    PropertyDef { name: "name", display_name: "Name", kind: PropertyKind::String, required: false, default: Some("") },
    PropertyDef { name: "name", display_name: "Name", kind: PropertyKind::String, required: false, default: Some("") },
    PropertyDef { name: "description", display_name: "Description", kind: PropertyKind::String, required: false, default: Some("") },
    PropertyDef { name: "language", display_name: "Language", kind: PropertyKind::Options, required: false, default: Some("javaScript") },
    PropertyDef { name: "jsCode", display_name: "JavaScript", kind: PropertyKind::String, required: false, default: Some("// Example: convert the incoming query to uppercase and return it\\nreturn query.toUpperCase()") },
    PropertyDef { name: "pythonCode", display_name: "Python", kind: PropertyKind::String, required: false, default: Some("# Example: convert the incoming query to uppercase and return it\\nreturn _query.upper()") },
    PropertyDef { name: "specifyInputSchema", display_name: "Specify Input Schema", kind: PropertyKind::Boolean, required: false, default: None }
],
    credentials: &[],
};

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

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

inventory::submit! { NodeFactory::new("toolcode", || Arc::new(ToolcodeNode)) }
