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

static META: NodeMetadata = NodeMetadata {
    name: "openweathermap",
    display_name: "OpenWeatherMap",
    version: &[1],
    group: &["transform"],
    description: "Gets current and future weather information",
    inputs: 1,
    outputs: 1,
    properties: &[
    PropertyDef { name: "operation", display_name: "Operation", kind: PropertyKind::Options, required: false, default: Some("currentWeather") },
    PropertyDef { name: "format", display_name: "Format", kind: PropertyKind::Options, required: false, default: Some("metric") },
    PropertyDef { name: "locationSelection", display_name: "Location Selection", kind: PropertyKind::Options, required: false, default: Some("cityName") },
    PropertyDef { name: "cityName", display_name: "City", kind: PropertyKind::String, required: true, default: Some("") },
    PropertyDef { name: "cityId", display_name: "City ID", kind: PropertyKind::Number, required: true, default: None },
    PropertyDef { name: "latitude", display_name: "Latitude", kind: PropertyKind::String, required: true, default: Some("") },
    PropertyDef { name: "longitude", display_name: "Longitude", kind: PropertyKind::String, required: true, default: Some("") },
    PropertyDef { name: "zipCode", display_name: "Zip Code", kind: PropertyKind::String, required: true, default: Some("") },
    PropertyDef { name: "language", display_name: "Language", kind: PropertyKind::String, required: false, default: Some("") }
],
    credentials: &[
    CredentialRef { name: "openWeatherMapApi", required: true }
],
};

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

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

inventory::submit! { NodeFactory::new("openweathermap", || Arc::new(OpenweathermapNode)) }
