use serde::{Deserialize, Serialize}; /*
                                      * Cloud SQL Admin API
                                      *
                                      * API for Cloud SQL database instance management
                                      *
                                      * The version of the OpenAPI document: v1
                                      *
                                      * Generated by: https://openapi-generator.tech
                                      */

/// BackupRetentionSettings : We currently only support backup retention by specifying the number of backups we will retain.

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct BackupRetentionSettings {
    /// Depending on the value of retention_unit, this is used to determine if a backup needs to be deleted. If retention_unit is 'COUNT', we will retain this many backups.
    #[serde(rename = "retainedBackups", skip_serializing_if = "Option::is_none")]
    pub retained_backups: Option<i32>,
    /// The unit that 'retained_backups' represents.
    #[serde(rename = "retentionUnit", skip_serializing_if = "Option::is_none")]
    pub retention_unit: Option<RetentionUnit>,
}

impl BackupRetentionSettings {
    /// We currently only support backup retention by specifying the number of backups we will retain.
    pub fn new() -> BackupRetentionSettings {
        BackupRetentionSettings {
            retained_backups: None,
            retention_unit: None,
        }
    }
}

/// The unit that 'retained_backups' represents.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum RetentionUnit {
    #[serde(rename = "RETENTION_UNIT_UNSPECIFIED")]
    RetentionUnitUnspecified,
    #[serde(rename = "COUNT")]
    Count,
}

impl Default for RetentionUnit {
    fn default() -> RetentionUnit {
        Self::RetentionUnitUnspecified
    }
}
