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

static META: NodeMetadata = NodeMetadata {
    name: "microsoftentra",
    display_name: "Microsoft Entra ID",
    version: &[1],
    group: &["transform"],
    description: "Interact with Microsoft Entra ID API",
    inputs: 1,
    outputs: 1,
    properties: &[
    PropertyDef { name: "resource", display_name: "Resource", kind: PropertyKind::Options, required: false, default: Some("user") }
],
    credentials: &[
    CredentialRef { name: "microsoftEntraOAuth2Api", required: true }
],
};

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

    async fn execute(&self, _ctx: &mut ExecuteCtx<'_>) -> Result<NodeOutput, NodeError> {
    static ROUTING: crate::engine::routing::RoutingDescriptor =
        crate::engine::routing::RoutingDescriptor {
            base_url: "={{ ($credentials.graphApiBaseUrl || ",
            credential: Some("microsoftEntraOAuth2Api"),
            auth_headers: &[],
            auth_query: &[],
            dispatch_param: "operation",
            operations: &[
                crate::engine::routing::OperationDescriptor {
                    value: "addGroup", method: "POST", url_template: "/groups/{{ $parameter[",
                    body_template: "", query: &[],
                },
                crate::engine::routing::OperationDescriptor {
                    value: "create", method: "POST", url_template: "/users",
                    body_template: "", query: &[],
                },
                crate::engine::routing::OperationDescriptor {
                    value: "delete", method: "DELETE", url_template: "/users/{{ $parameter[",
                    body_template: "", query: &[],
                },
                crate::engine::routing::OperationDescriptor {
                    value: "get", method: "GET", url_template: "/users/{{ $parameter[",
                    body_template: "", query: &[],
                },
                crate::engine::routing::OperationDescriptor {
                    value: "getAll", method: "GET", url_template: "/users",
                    body_template: "", query: &[],
                },
                crate::engine::routing::OperationDescriptor {
                    value: "removeGroup", method: "DELETE", url_template: "/groups/{{ $parameter[",
                    body_template: "", query: &[],
                },
                crate::engine::routing::OperationDescriptor {
                    value: "update", method: "PATCH", url_template: "/users/{{ $parameter[",
                    body_template: "", query: &[],
                }
            ],
            sends: &[
                crate::engine::routing::SendDescriptor {
                    param_name: "id", send_type: "body", dest_key: "@odata.id",
                    operations: &["addGroup"], resources: &["user"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "accountEnabled", send_type: "body", dest_key: "accountEnabled",
                    operations: &["create"], resources: &["user"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "displayName", send_type: "body", dest_key: "displayName",
                    operations: &["create"], resources: &["user"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "userPrincipalName", send_type: "body", dest_key: "userPrincipalName",
                    operations: &["create"], resources: &["user"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "Simplified", send_type: "query", dest_key: "$select",
                    operations: &["get"], resources: &["user"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "Raw", send_type: "query", dest_key: "$select",
                    operations: &["get"], resources: &["user"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "fields", send_type: "query", dest_key: "$select",
                    operations: &["get"], resources: &["user"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "limit", send_type: "query", dest_key: "$top",
                    operations: &["getAll"], resources: &["user"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "filter", send_type: "query", dest_key: "$filter",
                    operations: &["getAll"], resources: &["user"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "Minor", send_type: "body", dest_key: "ageGroup",
                    operations: &["update"], resources: &["user"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "businessPhones", send_type: "body", dest_key: "businessPhones",
                    operations: &["update"], resources: &["user"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "city", send_type: "body", dest_key: "city",
                    operations: &["update"], resources: &["user"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "companyName", send_type: "body", dest_key: "companyName",
                    operations: &["update"], resources: &["user"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "Granted", send_type: "body", dest_key: "consentProvidedForMinor",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "country", send_type: "body", dest_key: "country",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "department", send_type: "body", dest_key: "department",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "employeeId", send_type: "body", dest_key: "employeeId",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "employeeType", send_type: "body", dest_key: "employeeType",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "givenName", send_type: "body", dest_key: "givenName",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "employeeHireDate", send_type: "body", dest_key: "employeeHireDate",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "employeeLeaveDateTime", send_type: "body", dest_key: "employeeLeaveDateTime",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "costCenter", send_type: "body", dest_key: "employeeOrgData.costCenter",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "division", send_type: "body", dest_key: "employeeOrgData.division",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "jobTitle", send_type: "body", dest_key: "jobTitle",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "surname", send_type: "body", dest_key: "surname",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "mail", send_type: "body", dest_key: "mail",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "mailNickname", send_type: "body", dest_key: "mailNickname",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "mobilePhone", send_type: "body", dest_key: "mobilePhone",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "officeLocation", send_type: "body", dest_key: "officeLocation",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "onPremisesImmutableId", send_type: "body", dest_key: "onPremisesImmutableId",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "otherMails", send_type: "body", dest_key: "otherMails",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "password", send_type: "body", dest_key: "passwordProfile.password",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "passwordPolicies", send_type: "body", dest_key: "passwordPolicies",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "postalCode", send_type: "body", dest_key: "postalCode",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "preferredLanguage", send_type: "body", dest_key: "preferredLanguage",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "state", send_type: "body", dest_key: "state",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "streetAddress", send_type: "body", dest_key: "streetAddress",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "usageLocation", send_type: "body", dest_key: "usageLocation",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "mailEnabled", send_type: "body", dest_key: "mailEnabled",
                    operations: &["create"], resources: &["group"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "securityEnabled", send_type: "body", dest_key: "securityEnabled",
                    operations: &["create"], resources: &["group"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "isAssignableToRole", send_type: "body", dest_key: "isAssignableToRole",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "membershipRule", send_type: "body", dest_key: "membershipRule",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "Paused", send_type: "body", dest_key: "membershipRuleProcessingState",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "includeMembers", send_type: "query", dest_key: "$expand",
                    operations: &["get"], resources: &["group"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "description", send_type: "body", dest_key: "description",
                    operations: &["update"], resources: &["group"],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "preferredDataLocation", send_type: "body", dest_key: "preferredDataLocation",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "uniqueName", send_type: "body", dest_key: "uniqueName",
                    operations: &[], resources: &[],
                },
                crate::engine::routing::SendDescriptor {
                    param_name: "Public", send_type: "body", dest_key: "visibility",
                    operations: &[], resources: &[],
                }
            ],
        };
    crate::engine::routing::execute_routing(&ROUTING, _ctx).await
    }
}

inventory::submit! { NodeFactory::new("microsoftentra", || Arc::new(MicrosoftentraNode)) }
