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

static META: NodeMetadata = NodeMetadata {
    name: "kafkatrigger",
    display_name: "Kafka Trigger",
    version: &[1],
    group: &["transform"],
    description: "Consume messages from a Kafka topic",
    inputs: 1,
    outputs: 1,
    properties: &[
    PropertyDef { name: "topic", display_name: "Topic", kind: PropertyKind::String, required: true, default: Some("") },
    PropertyDef { name: "groupId", display_name: "Group ID", kind: PropertyKind::String, required: true, default: Some("") },
    PropertyDef { name: "resolveOffset", display_name: "Resolve Offset", kind: PropertyKind::Options, required: false, default: Some("onCompletion") },
    PropertyDef { name: "allowedStatuses", display_name: "Allowed Statuses", kind: PropertyKind::MultiOptions, required: false, default: None },
    PropertyDef { name: "useSchemaRegistry", display_name: "Use Schema Registry", kind: PropertyKind::Boolean, required: false, default: None },
    PropertyDef { name: "schemaRegistryUrl", display_name: "Schema Registry URL", kind: PropertyKind::String, required: true, default: Some("") },
    PropertyDef { name: "options", display_name: "Options", kind: PropertyKind::Collection, required: false, default: None }
],
    credentials: &[
    CredentialRef { name: "kafka", required: true }
],
};

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

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

inventory::submit! { NodeFactory::new("kafkatrigger", || Arc::new(KafkatriggerNode)) }
