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

/// ResourcePolicyGroupPlacementPolicy : A GroupPlacementPolicy specifies resource placement configuration. It specifies the failure bucket separation as well as network locality

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ResourcePolicyGroupPlacementPolicy {
    /// The number of availability domains to spread instances across. If two instances are in different availability domain, they are not in the same low latency network.
    #[serde(
        rename = "availabilityDomainCount",
        skip_serializing_if = "Option::is_none"
    )]
    pub availability_domain_count: Option<i32>,
    /// Specifies network collocation
    #[serde(rename = "collocation", skip_serializing_if = "Option::is_none")]
    pub collocation: Option<Collocation>,
    /// Number of VMs in this placement group. Google does not recommend that you use this field unless you use a compact policy and you want your policy to work only if it contains this exact number of VMs.
    #[serde(rename = "vmCount", skip_serializing_if = "Option::is_none")]
    pub vm_count: Option<i32>,
}

impl ResourcePolicyGroupPlacementPolicy {
    /// A GroupPlacementPolicy specifies resource placement configuration. It specifies the failure bucket separation as well as network locality
    pub fn new() -> ResourcePolicyGroupPlacementPolicy {
        ResourcePolicyGroupPlacementPolicy {
            availability_domain_count: None,
            collocation: None,
            vm_count: None,
        }
    }
}

/// Specifies network collocation
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Collocation {
    #[serde(rename = "COLLOCATED")]
    Collocated,
    #[serde(rename = "UNSPECIFIED_COLLOCATION")]
    UnspecifiedCollocation,
}

impl Default for Collocation {
    fn default() -> Collocation {
        Self::Collocated
    }
}
