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

static META: NodeMetadata = NodeMetadata {
    name: "sort",
    display_name: "Sort",
    version: &[1],
    group: &["transform"],
    description: "Change items order",
    inputs: 1,
    outputs: 1,
    properties: &[
    PropertyDef { name: "type", display_name: "Type", kind: PropertyKind::Options, required: false, default: Some("simple") },
    PropertyDef { name: "sortFieldsUi", display_name: "Fields To Sort By", kind: PropertyKind::FixedCollection, required: true, default: Some("") },
    PropertyDef { name: "code", display_name: "Code", kind: PropertyKind::String, required: false, default: Some("// The two items to compare are in the variables a and b\n\t// Access the fields in a.json and b.json\n\t// Return -1 if a should go before b\n\t// Return 1 if b should go before a\n\t// Return 0 if there") },
    PropertyDef { name: "options", display_name: "Options", kind: PropertyKind::Collection, required: false, default: None }
],
    credentials: &[],
};

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

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

inventory::submit! { NodeFactory::new("sort", || Arc::new(SortNode)) }
