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

use crate::google_rest_apis::sqladmin_v1::models;

/// ReplicaConfiguration : Read-replica configuration for connecting to the primary instance.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ReplicaConfiguration {
    /// Specifies if the replica is the failover target. If the field is set to `true`, the replica will be designated as a failover replica. In case the primary instance fails, the replica instance will be promoted as the new primary instance. Only one replica can be specified as failover target, and the replica has to be in different zone with the primary instance.
    #[serde(rename = "failoverTarget", skip_serializing_if = "Option::is_none")]
    pub failover_target: Option<bool>,
    /// This is always `sql#replicaConfiguration`.
    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
    pub kind: Option<String>,
    #[serde(
        rename = "mysqlReplicaConfiguration",
        skip_serializing_if = "Option::is_none"
    )]
    pub mysql_replica_configuration: Option<Box<models::MySqlReplicaConfiguration>>,
}

impl ReplicaConfiguration {
    /// Read-replica configuration for connecting to the primary instance.
    pub fn new() -> ReplicaConfiguration {
        ReplicaConfiguration {
            failover_target: None,
            kind: None,
            mysql_replica_configuration: None,
        }
    }
}
