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

/// BackupRun : A BackupRun resource.

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct BackupRun {
    /// Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT.
    #[serde(rename = "backupKind", skip_serializing_if = "Option::is_none")]
    pub backup_kind: Option<BackupKind>,
    /// The description of this run, only applicable to on-demand backups.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[serde(
        rename = "diskEncryptionConfiguration",
        skip_serializing_if = "Option::is_none"
    )]
    pub disk_encryption_configuration:
        Option<Box<crate::google_rest_apis::sqladmin_v1::models::DiskEncryptionConfiguration>>,
    #[serde(
        rename = "diskEncryptionStatus",
        skip_serializing_if = "Option::is_none"
    )]
    pub disk_encryption_status:
        Option<Box<crate::google_rest_apis::sqladmin_v1::models::DiskEncryptionStatus>>,
    /// The time the backup operation completed in UTC timezone in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example `2012-11-15T16:19:00.094Z`.
    #[serde(rename = "endTime", skip_serializing_if = "Option::is_none")]
    pub end_time: Option<String>,
    /// The time the run was enqueued in UTC timezone in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example `2012-11-15T16:19:00.094Z`.
    #[serde(rename = "enqueuedTime", skip_serializing_if = "Option::is_none")]
    pub enqueued_time: Option<String>,
    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
    pub error: Option<Box<crate::google_rest_apis::sqladmin_v1::models::OperationError>>,
    /// The identifier for this backup run. Unique only for a specific Cloud SQL instance.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// Name of the database instance.
    #[serde(rename = "instance", skip_serializing_if = "Option::is_none")]
    pub instance: Option<String>,
    /// This is always `sql#backupRun`.
    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
    pub kind: Option<String>,
    /// Location of the backups.
    #[serde(rename = "location", skip_serializing_if = "Option::is_none")]
    pub location: Option<String>,
    /// The URI of this resource.
    #[serde(rename = "selfLink", skip_serializing_if = "Option::is_none")]
    pub self_link: Option<String>,
    /// The time the backup operation actually started in UTC timezone in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example `2012-11-15T16:19:00.094Z`.
    #[serde(rename = "startTime", skip_serializing_if = "Option::is_none")]
    pub start_time: Option<String>,
    /// The status of this run.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
    /// Backup time zone to prevent restores to an instance with a different time zone. Now relevant only for SQL Server.
    #[serde(rename = "timeZone", skip_serializing_if = "Option::is_none")]
    pub time_zone: Option<String>,
    /// The type of this run; can be either \"AUTOMATED\" or \"ON_DEMAND\" or \"FINAL\". This field defaults to \"ON_DEMAND\" and is ignored, when specified for insert requests.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<Type>,
    /// The start time of the backup window during which this the backup was attempted in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example `2012-11-15T16:19:00.094Z`.
    #[serde(rename = "windowStartTime", skip_serializing_if = "Option::is_none")]
    pub window_start_time: Option<String>,
}

impl BackupRun {
    /// A BackupRun resource.
    pub fn new() -> BackupRun {
        BackupRun {
            backup_kind: None,
            description: None,
            disk_encryption_configuration: None,
            disk_encryption_status: None,
            end_time: None,
            enqueued_time: None,
            error: None,
            id: None,
            instance: None,
            kind: None,
            location: None,
            self_link: None,
            start_time: None,
            status: None,
            time_zone: None,
            r#type: None,
            window_start_time: None,
        }
    }
}

/// Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum BackupKind {
    #[serde(rename = "SQL_BACKUP_KIND_UNSPECIFIED")]
    SqlBackupKindUnspecified,
    #[serde(rename = "SNAPSHOT")]
    Snapshot,
    #[serde(rename = "PHYSICAL")]
    Physical,
}

impl Default for BackupKind {
    fn default() -> BackupKind {
        Self::SqlBackupKindUnspecified
    }
}
/// The status of this run.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "SQL_BACKUP_RUN_STATUS_UNSPECIFIED")]
    SqlBackupRunStatusUnspecified,
    #[serde(rename = "ENQUEUED")]
    Enqueued,
    #[serde(rename = "OVERDUE")]
    Overdue,
    #[serde(rename = "RUNNING")]
    Running,
    #[serde(rename = "FAILED")]
    Failed,
    #[serde(rename = "SUCCESSFUL")]
    Successful,
    #[serde(rename = "SKIPPED")]
    Skipped,
    #[serde(rename = "DELETION_PENDING")]
    DeletionPending,
    #[serde(rename = "DELETION_FAILED")]
    DeletionFailed,
    #[serde(rename = "DELETED")]
    Deleted,
}

impl Default for Status {
    fn default() -> Status {
        Self::SqlBackupRunStatusUnspecified
    }
}
/// The type of this run; can be either \"AUTOMATED\" or \"ON_DEMAND\" or \"FINAL\". This field defaults to \"ON_DEMAND\" and is ignored, when specified for insert requests.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "SQL_BACKUP_RUN_TYPE_UNSPECIFIED")]
    SqlBackupRunTypeUnspecified,
    #[serde(rename = "AUTOMATED")]
    Automated,
    #[serde(rename = "ON_DEMAND")]
    OnDemand,
}

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