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

static META: NodeMetadata = NodeMetadata {
    name: "memorybufferwindow",
    display_name: "Simple Memory",
    version: &[1],
    group: &["transform"],
    description: "Stores in n8n memory, so no credentials required",
    inputs: 1,
    outputs: 1,
    properties: &[
    PropertyDef { name: "scalingNotice", display_name: "This node stores memory locally in the n8n instance. It is not compatible with Queue Mode or Multi-Main setups, as memory will not be shared across workers. For production use with scaling, consider using an external memory store such as Redis, Postgres, or another persistent memory node.", kind: PropertyKind::Notice, required: false, default: Some("") },
    PropertyDef { name: "sessionKey", display_name: "Session Key", kind: PropertyKind::String, required: false, default: Some("chat_history") },
    PropertyDef { name: "sessionKey", display_name: "Session ID", kind: PropertyKind::String, required: false, default: Some("={{ $json.sessionId }}") }
],
    credentials: &[],
};

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

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

inventory::submit! { NodeFactory::new("memorybufferwindow", || Arc::new(MemorybufferwindowNode)) }
