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 PreservedStatePreservedDisk {
    /// These stateful disks will never be deleted during autohealing, update, instance recreate operations. This flag is used to configure if the disk should be deleted after it is no longer used by the group, e.g. when the given instance or the whole MIG is deleted. Note: disks attached in READ_ONLY mode cannot be auto-deleted.
    #[serde(rename = "autoDelete", skip_serializing_if = "Option::is_none")]
    pub auto_delete: Option<AutoDelete>,
    /// The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode.
    #[serde(rename = "mode", skip_serializing_if = "Option::is_none")]
    pub mode: Option<Mode>,
    /// The URL of the disk resource that is stateful and should be attached to the VM instance.
    #[serde(rename = "source", skip_serializing_if = "Option::is_none")]
    pub source: Option<String>,
}

impl PreservedStatePreservedDisk {
    pub fn new() -> PreservedStatePreservedDisk {
        PreservedStatePreservedDisk {
            auto_delete: None,
            mode: None,
            source: None,
        }
    }
}

/// These stateful disks will never be deleted during autohealing, update, instance recreate operations. This flag is used to configure if the disk should be deleted after it is no longer used by the group, e.g. when the given instance or the whole MIG is deleted. Note: disks attached in READ_ONLY mode cannot be auto-deleted.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AutoDelete {
    #[serde(rename = "NEVER")]
    Never,
    #[serde(rename = "ON_PERMANENT_INSTANCE_DELETION")]
    OnPermanentInstanceDeletion,
}

impl Default for AutoDelete {
    fn default() -> AutoDelete {
        Self::Never
    }
}
/// The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Mode {
    #[serde(rename = "READ_ONLY")]
    Only,
    #[serde(rename = "READ_WRITE")]
    Write,
}

impl Default for Mode {
    fn default() -> Mode {
        Self::Only
    }
}
