// AUTO-GENERATED — do not edit by hand
// Upstream: https://github.com/n8n-io/n8n/blob/master/packages/nodes-base/nodes/Jenkins/Jenkins.node.ts
// To implement: copy to ../impl/jenkins.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 JenkinsNode;

static META: NodeMetadata = NodeMetadata {
    name: "jenkins",
    display_name: "Jenkins",
    version: &[1],
    group: &["transform"],
    description: "Consume Jenkins API",
    inputs: 1,
    outputs: 1,
    properties: &[
    PropertyDef { name: "resource", display_name: "Resource", kind: PropertyKind::Options, required: false, default: Some("job") },
    PropertyDef { name: "operation", display_name: "Operation", kind: PropertyKind::Options, required: false, default: Some("trigger") },
    PropertyDef { name: "triggerParamsNotice", display_name: "Make sure the job is setup to support triggering with parameters. <a href=", kind: PropertyKind::Notice, required: false, default: Some("") },
    PropertyDef { name: "job", display_name: "Job Name or ID", kind: PropertyKind::Options, required: true, default: Some("") },
    PropertyDef { name: "param", display_name: "Parameters", kind: PropertyKind::FixedCollection, required: true, default: Some("") },
    PropertyDef { name: "newJob", display_name: "New Job Name", kind: PropertyKind::String, required: true, default: Some("") },
    PropertyDef { name: "xml", display_name: "XML", kind: PropertyKind::String, required: true, default: Some("") },
    PropertyDef { name: "createNotice", display_name: "To get the XML of an existing job, add ‘config.xml’ to the end of the job URL", kind: PropertyKind::Notice, required: false, default: Some("") },
    PropertyDef { name: "operation", display_name: "Operation", kind: PropertyKind::Options, required: false, default: Some("safeRestart") },
    PropertyDef { name: "reason", display_name: "Reason", kind: PropertyKind::String, required: false, default: Some("") },
    PropertyDef { name: "instanceNotice", display_name: "Instance operation can shutdown Jenkins instance and make it unresponsive. Some commands may not be available depending on instance implementation.", kind: PropertyKind::Notice, required: false, default: Some("") },
    PropertyDef { name: "operation", display_name: "Operation", kind: PropertyKind::Options, required: false, default: Some("getAll") },
    PropertyDef { name: "job", display_name: "Job Name or ID", kind: PropertyKind::Options, required: true, default: Some("") },
    PropertyDef { name: "returnAll", display_name: "Return All", kind: PropertyKind::Boolean, required: false, default: None },
    PropertyDef { name: "limit", display_name: "Limit", kind: PropertyKind::Number, required: false, default: None }
],
    credentials: &[
    CredentialRef { name: "jenkinsApi", required: true }
],
};

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

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

inventory::submit! { NodeFactory::new("jenkins", || Arc::new(JenkinsNode)) }
