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

/// Commitment : Represents a regional Commitment resource. Creating a commitment resource means that you are purchasing a committed use contract with an explicit start and end time. You can create commitments based on vCPUs and memory usage and receive discounted rates. For full details, read Signing Up for Committed Use Discounts.

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct Commitment {
    /// Specifies whether to enable automatic renewal for the commitment. The default value is false if not specified. The field can be updated until the day of the commitment expiration at 12:00am PST. If the field is set to true, the commitment will be automatically renewed for either one or three years according to the terms of the existing commitment.
    #[serde(rename = "autoRenew", skip_serializing_if = "Option::is_none")]
    pub auto_renew: Option<bool>,
    /// The category of the commitment. Category MACHINE specifies commitments composed of machine resources such as VCPU or MEMORY, listed in resources. Category LICENSE specifies commitments composed of software licenses, listed in licenseResources. Note that only MACHINE commitments should have a Type specified.
    #[serde(rename = "category", skip_serializing_if = "Option::is_none")]
    pub category: Option<Category>,
    /// [Output Only] Creation timestamp in RFC3339 text format.
    #[serde(rename = "creationTimestamp", skip_serializing_if = "Option::is_none")]
    pub creation_timestamp: Option<String>,
    /// An optional description of this resource. Provide this property when you create the resource.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// [Output Only] Commitment end time in RFC3339 text format.
    #[serde(rename = "endTimestamp", skip_serializing_if = "Option::is_none")]
    pub end_timestamp: Option<String>,
    /// [Output Only] The unique identifier for the resource. This identifier is defined by the server.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// [Output Only] Type of the resource. Always compute#commitment for commitments.
    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
    pub kind: Option<String>,
    #[serde(rename = "licenseResource", skip_serializing_if = "Option::is_none")]
    pub license_resource:
        Option<Box<crate::google_rest_apis::compute_v1::models::LicenseResourceCommitment>>,
    /// List of source commitments to be merged into a new commitment.
    #[serde(
        rename = "mergeSourceCommitments",
        skip_serializing_if = "Option::is_none"
    )]
    pub merge_source_commitments: Option<Vec<String>>,
    /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// The plan for this commitment, which determines duration and discount rate. The currently supported plans are TWELVE_MONTH (1 year), and THIRTY_SIX_MONTH (3 years).
    #[serde(rename = "plan", skip_serializing_if = "Option::is_none")]
    pub plan: Option<Plan>,
    /// [Output Only] URL of the region where this commitment may be used.
    #[serde(rename = "region", skip_serializing_if = "Option::is_none")]
    pub region: Option<String>,
    /// List of create-on-create reseravtions for this commitment.
    #[serde(rename = "reservations", skip_serializing_if = "Option::is_none")]
    pub reservations: Option<Vec<crate::google_rest_apis::compute_v1::models::Reservation>>,
    /// A list of commitment amounts for particular resources. Note that VCPU and MEMORY resource commitments must occur together.
    #[serde(rename = "resources", skip_serializing_if = "Option::is_none")]
    pub resources: Option<Vec<crate::google_rest_apis::compute_v1::models::ResourceCommitment>>,
    /// [Output Only] Server-defined URL for the resource.
    #[serde(rename = "selfLink", skip_serializing_if = "Option::is_none")]
    pub self_link: Option<String>,
    /// Source commitment to be split into a new commitment.
    #[serde(
        rename = "splitSourceCommitment",
        skip_serializing_if = "Option::is_none"
    )]
    pub split_source_commitment: Option<String>,
    /// [Output Only] Commitment start time in RFC3339 text format.
    #[serde(rename = "startTimestamp", skip_serializing_if = "Option::is_none")]
    pub start_timestamp: Option<String>,
    /// [Output Only] Status of the commitment with regards to eventual expiration (each commitment has an end date defined). One of the following values: NOT_YET_ACTIVE, ACTIVE, EXPIRED.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
    /// [Output Only] An optional, human-readable explanation of the status.
    #[serde(rename = "statusMessage", skip_serializing_if = "Option::is_none")]
    pub status_message: Option<String>,
    /// The type of commitment, which affects the discount rate and the eligible resources. Type MEMORY_OPTIMIZED specifies a commitment that will only apply to memory optimized machines. Type ACCELERATOR_OPTIMIZED specifies a commitment that will only apply to accelerator optimized machines.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<Type>,
}

impl Commitment {
    /// Represents a regional Commitment resource. Creating a commitment resource means that you are purchasing a committed use contract with an explicit start and end time. You can create commitments based on vCPUs and memory usage and receive discounted rates. For full details, read Signing Up for Committed Use Discounts.
    pub fn new() -> Commitment {
        Commitment {
            auto_renew: None,
            category: None,
            creation_timestamp: None,
            description: None,
            end_timestamp: None,
            id: None,
            kind: None,
            license_resource: None,
            merge_source_commitments: None,
            name: None,
            plan: None,
            region: None,
            reservations: None,
            resources: None,
            self_link: None,
            split_source_commitment: None,
            start_timestamp: None,
            status: None,
            status_message: None,
            r#type: None,
        }
    }
}

/// The category of the commitment. Category MACHINE specifies commitments composed of machine resources such as VCPU or MEMORY, listed in resources. Category LICENSE specifies commitments composed of software licenses, listed in licenseResources. Note that only MACHINE commitments should have a Type specified.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Category {
    #[serde(rename = "CATEGORY_UNSPECIFIED")]
    CategoryUnspecified,
    #[serde(rename = "LICENSE")]
    License,
    #[serde(rename = "MACHINE")]
    Machine,
}

impl Default for Category {
    fn default() -> Category {
        Self::CategoryUnspecified
    }
}
/// The plan for this commitment, which determines duration and discount rate. The currently supported plans are TWELVE_MONTH (1 year), and THIRTY_SIX_MONTH (3 years).
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Plan {
    #[serde(rename = "INVALID")]
    Invalid,
    #[serde(rename = "THIRTY_SIX_MONTH")]
    ThirtySixMonth,
    #[serde(rename = "TWELVE_MONTH")]
    TwelveMonth,
}

impl Default for Plan {
    fn default() -> Plan {
        Self::Invalid
    }
}
/// [Output Only] Status of the commitment with regards to eventual expiration (each commitment has an end date defined). One of the following values: NOT_YET_ACTIVE, ACTIVE, EXPIRED.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "ACTIVE")]
    Active,
    #[serde(rename = "CANCELLED")]
    Cancelled,
    #[serde(rename = "CREATING")]
    Creating,
    #[serde(rename = "EXPIRED")]
    Expired,
    #[serde(rename = "NOT_YET_ACTIVE")]
    NotYetActive,
}

impl Default for Status {
    fn default() -> Status {
        Self::Active
    }
}
/// The type of commitment, which affects the discount rate and the eligible resources. Type MEMORY_OPTIMIZED specifies a commitment that will only apply to memory optimized machines. Type ACCELERATOR_OPTIMIZED specifies a commitment that will only apply to accelerator optimized machines.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "ACCELERATOR_OPTIMIZED")]
    AcceleratorOptimized,
    #[serde(rename = "ACCELERATOR_OPTIMIZED_A3")]
    AcceleratorOptimizedA3,
    #[serde(rename = "COMPUTE_OPTIMIZED")]
    ComputeOptimized,
    #[serde(rename = "COMPUTE_OPTIMIZED_C2D")]
    ComputeOptimizedC2D,
    #[serde(rename = "COMPUTE_OPTIMIZED_C3")]
    ComputeOptimizedC3,
    #[serde(rename = "COMPUTE_OPTIMIZED_C3D")]
    ComputeOptimizedC3D,
    #[serde(rename = "COMPUTE_OPTIMIZED_H3")]
    ComputeOptimizedH3,
    #[serde(rename = "GENERAL_PURPOSE")]
    GeneralPurpose,
    #[serde(rename = "GENERAL_PURPOSE_E2")]
    GeneralPurposeE2,
    #[serde(rename = "GENERAL_PURPOSE_N2")]
    GeneralPurposeN2,
    #[serde(rename = "GENERAL_PURPOSE_N2D")]
    GeneralPurposeN2D,
    #[serde(rename = "GENERAL_PURPOSE_T2D")]
    GeneralPurposeT2D,
    #[serde(rename = "GRAPHICS_OPTIMIZED")]
    GraphicsOptimized,
    #[serde(rename = "MEMORY_OPTIMIZED")]
    MemoryOptimized,
    #[serde(rename = "MEMORY_OPTIMIZED_M3")]
    MemoryOptimizedM3,
    #[serde(rename = "TYPE_UNSPECIFIED")]
    TypeUnspecified,
}

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