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

use crate::google_rest_apis::compute_v1::models;

/// ResourceCommitment : Commitment for a particular resource (a Commitment is composed of one or more of these).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ResourceCommitment {
    /// Name of the accelerator type resource. Applicable only when the type is ACCELERATOR.
    #[serde(rename = "acceleratorType", skip_serializing_if = "Option::is_none")]
    pub accelerator_type: Option<String>,
    /// The amount of the resource purchased (in a type-dependent unit, such as bytes). For vCPUs, this can just be an integer. For memory, this must be provided in MB. Memory must be a multiple of 256 MB, with up to 6.5GB of memory per every vCPU.
    #[serde(rename = "amount", skip_serializing_if = "Option::is_none")]
    pub amount: Option<String>,
    /// Type of resource for which this commitment applies. Possible values are VCPU, MEMORY, LOCAL_SSD, and ACCELERATOR.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<Type>,
}

impl ResourceCommitment {
    /// Commitment for a particular resource (a Commitment is composed of one or more of these).
    pub fn new() -> ResourceCommitment {
        ResourceCommitment {
            accelerator_type: None,
            amount: None,
            r#type: None,
        }
    }
}
/// Type of resource for which this commitment applies. Possible values are VCPU, MEMORY, LOCAL_SSD, and ACCELERATOR.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "ACCELERATOR")]
    Accelerator,
    #[serde(rename = "LOCAL_SSD")]
    LocalSsd,
    #[serde(rename = "MEMORY")]
    Memory,
    #[serde(rename = "UNSPECIFIED")]
    Unspecified,
    #[serde(rename = "VCPU")]
    Vcpu,
}

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