/*
 * Hetzner Cloud API
 *
 * Copied from the official API documentation for the Public Hetzner Cloud.
 *
 * The version of the OpenAPI document: 4b3f595
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// CreateLoadBalancerRequest : Request for POST https://api.hetzner.cloud/v1/load_balancers
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateLoadBalancerRequest {
    #[serde(rename = "algorithm", skip_serializing_if = "Option::is_none")]
    pub algorithm: Option<Box<models::LoadBalancerAlgorithm>>,
    /// User-defined labels (`key/value` pairs) for the Resource. For more information, see \"Labels\".  | User-defined labels (`key/value` pairs) for the Resource.  Note that the set of Labels provided in the request will overwrite the existing one.  For more information, see \"Labels\".
    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
    pub labels: Option<std::collections::HashMap<String, String>>,
    /// ID or name of the Load Balancer type this Load Balancer should be created with.
    #[serde(rename = "load_balancer_type")]
    pub load_balancer_type: String,
    /// ID or name of Location to create Load Balancer in.
    #[serde(rename = "location", skip_serializing_if = "Option::is_none")]
    pub location: Option<String>,
    /// Name of the Load Balancer.
    #[serde(rename = "name")]
    pub name: String,
    /// ID of the network the Load Balancer should be attached to on creation.
    #[serde(rename = "network", skip_serializing_if = "Option::is_none")]
    pub network: Option<i64>,
    /// Name of network zone.
    #[serde(rename = "network_zone", skip_serializing_if = "Option::is_none")]
    pub network_zone: Option<String>,
    /// Enable or disable the public interface of the Load Balancer.
    #[serde(rename = "public_interface", skip_serializing_if = "Option::is_none")]
    pub public_interface: Option<bool>,
    /// Array of services.
    #[serde(rename = "services", skip_serializing_if = "Option::is_none")]
    pub services: Option<Vec<models::LoadBalancerService>>,
    /// Array of targets.
    #[serde(rename = "targets", skip_serializing_if = "Option::is_none")]
    pub targets: Option<Vec<models::LoadBalancerAddTarget>>,
}

impl CreateLoadBalancerRequest {
    /// Request for POST https://api.hetzner.cloud/v1/load_balancers
    pub fn new(load_balancer_type: String, name: String) -> CreateLoadBalancerRequest {
        CreateLoadBalancerRequest {
            algorithm: None,
            labels: None,
            load_balancer_type,
            location: None,
            name,
            network: None,
            network_zone: None,
            public_interface: None,
            services: None,
            targets: None,
        }
    }
}
