/*
 * This is an auto-generated file.
 * Any manual changes may be overwritten without notice!
 */

use derive_builder::Builder;
use serde::{Deserialize, Serialize};

/// AutopilotUpgrade holds the current upgrade status.  (Enterprise only)
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct AutopilotUpgrade {
    /// TargetVersionVoters holds the list of servers that are voters in the Raft
    /// configuration of the TargetVersion.
    #[serde(
        rename = "TargetVersionVoters",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub target_version_voters: Vec<String>,

    /// TargetVersionNonVoters holds the list of servers that are non-voters in
    /// the Raft configuration of the TargetVersion.
    #[serde(
        rename = "TargetVersionNonVoters",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub target_version_non_voters: Vec<String>,

    /// OtherVersionVoters holds the list of servers that are voters in the Raft
    /// configuration of a version other than the TargetVersion.
    #[serde(
        rename = "OtherVersionVoters",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub other_version_voters: Vec<String>,

    /// OtherVersionNonVoters holds the list of servers that are non-voters in
    /// the Raft configuration of a version other than the TargetVersion.
    #[serde(
        rename = "OtherVersionNonVoters",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub other_version_non_voters: Vec<String>,

    /// OtherVersionReadReplicas holds the list of servers that are read replicas
    /// in the Raft configuration of a version other than the TargetVersion.
    #[serde(
        rename = "OtherVersionReadReplicas",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub other_version_read_replicas: Vec<String>,

    /// Status of the upgrade.
    #[serde(rename = "Status")]
    pub status: String,

    /// TargetVersionReadReplicas holds the list of servers that are read
    /// replicas in the Raft configuration of the TargetVersion.
    #[serde(
        rename = "TargetVersionReadReplicas",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub target_version_read_replicas: Vec<String>,

    /// RedundancyZones holds the list of servers in each redundancy zone for the
    /// TargetVersion.
    #[serde(rename = "RedundancyZones")]
    pub redundancy_zones: std::collections::HashMap<String, super::AutopilotZoneUpgradeVersions>,

    /// TargetVersion is the version that the cluster is upgrading to.
    #[serde(rename = "TargetVersion")]
    pub target_version: String,
}
