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;

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PerInstanceConfig {
    /// Fingerprint of this per-instance config. This field can be used in optimistic locking. It is ignored when inserting a per-instance config. An up-to-date fingerprint must be provided in order to update an existing per-instance configuration or the field needs to be unset.
    #[serde(rename = "fingerprint", skip_serializing_if = "Option::is_none")]
    pub fingerprint: Option<String>,
    /// The name of a per-instance configuration and its corresponding instance. Serves as a merge key during UpdatePerInstanceConfigs operations, that is, if a per-instance configuration with the same name exists then it will be updated, otherwise a new one will be created for the VM instance with the same name. An attempt to create a per-instance configconfiguration for a VM instance that either doesn't exist or is not part of the group will result in an error.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(rename = "preservedState", skip_serializing_if = "Option::is_none")]
    pub preserved_state: Option<Box<models::PreservedState>>,
    /// The status of applying this per-instance configuration on the corresponding managed instance.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
}

impl PerInstanceConfig {
    pub fn new() -> PerInstanceConfig {
        PerInstanceConfig {
            fingerprint: None,
            name: None,
            preserved_state: None,
            status: None,
        }
    }
}
/// The status of applying this per-instance configuration on the corresponding managed instance.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "APPLYING")]
    Applying,
    #[serde(rename = "DELETING")]
    Deleting,
    #[serde(rename = "EFFECTIVE")]
    Effective,
    #[serde(rename = "NONE")]
    None,
    #[serde(rename = "UNAPPLIED")]
    Unapplied,
    #[serde(rename = "UNAPPLIED_DELETION")]
    UnappliedDeletion,
}

impl Default for Status {
    fn default() -> Status {
        Self::Applying
    }
}
