/*
 * 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};

/// LoadBalancerAlgorithm : Algorithm of the Load Balancer.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct LoadBalancerAlgorithm {
    /// Type of the algorithm.
    #[serde(rename = "type")]
    pub r#type: Type,
}

impl LoadBalancerAlgorithm {
    /// Algorithm of the Load Balancer.
    pub fn new(r#type: Type) -> LoadBalancerAlgorithm {
        LoadBalancerAlgorithm { r#type }
    }
}
/// Type of the algorithm.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "least_connections")]
    LeastConnections,
    #[serde(rename = "round_robin")]
    RoundRobin,
}

impl Default for Type {
    fn default() -> Type {
        Self::LeastConnections
    }
}
