use serde::{Deserialize, Serialize}; /*
                                      * Compute Engine API
                                      *
                                      * Creates and runs virtual machines on Google Cloud Platform.
                                      *
                                      * The version of the OpenAPI document: v1
                                      *
                                      * Generated by: https://openapi-generator.tech
                                      */

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct HealthStatus {
    /// Metadata defined as annotations for network endpoint.
    #[serde(rename = "annotations", skip_serializing_if = "Option::is_none")]
    pub annotations: Option<::std::collections::HashMap<String, String>>,
    /// URL of the forwarding rule associated with the health status of the instance.
    #[serde(rename = "forwardingRule", skip_serializing_if = "Option::is_none")]
    pub forwarding_rule: Option<String>,
    /// A forwarding rule IP address assigned to this instance.
    #[serde(rename = "forwardingRuleIp", skip_serializing_if = "Option::is_none")]
    pub forwarding_rule_ip: Option<String>,
    /// Health state of the IPv4 address of the instance.
    #[serde(rename = "healthState", skip_serializing_if = "Option::is_none")]
    pub health_state: Option<HealthState>,
    /// URL of the instance resource.
    #[serde(rename = "instance", skip_serializing_if = "Option::is_none")]
    pub instance: Option<String>,
    /// For target pool based Network Load Balancing, it indicates the forwarding rule's IP address assigned to this instance. For other types of load balancing, the field indicates VM internal ip.
    #[serde(rename = "ipAddress", skip_serializing_if = "Option::is_none")]
    pub ip_address: Option<String>,
    /// The named port of the instance group, not necessarily the port that is health-checked.
    #[serde(rename = "port", skip_serializing_if = "Option::is_none")]
    pub port: Option<i32>,
    #[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
    pub weight: Option<String>,
    #[serde(rename = "weightError", skip_serializing_if = "Option::is_none")]
    pub weight_error: Option<WeightError>,
}

impl HealthStatus {
    pub fn new() -> HealthStatus {
        HealthStatus {
            annotations: None,
            forwarding_rule: None,
            forwarding_rule_ip: None,
            health_state: None,
            instance: None,
            ip_address: None,
            port: None,
            weight: None,
            weight_error: None,
        }
    }
}

/// Health state of the IPv4 address of the instance.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum HealthState {
    #[serde(rename = "HEALTHY")]
    Healthy,
    #[serde(rename = "UNHEALTHY")]
    Unhealthy,
}

impl Default for HealthState {
    fn default() -> HealthState {
        Self::Healthy
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum WeightError {
    #[serde(rename = "INVALID_WEIGHT")]
    InvalidWeight,
    #[serde(rename = "MISSING_WEIGHT")]
    MissingWeight,
    #[serde(rename = "UNAVAILABLE_WEIGHT")]
    UnavailableWeight,
    #[serde(rename = "WEIGHT_NONE")]
    WeightNone,
}

impl Default for WeightError {
    fn default() -> WeightError {
        Self::InvalidWeight
    }
}
