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

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

/// Deployment is used to serialize an deployment.
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct Deployment {
    /// TaskGroups is the set of task groups effected by the deployment and their
    /// current deployment status.
    #[serde(rename = "TaskGroups")]
    pub task_groups: std::collections::HashMap<String, super::DeploymentState>,

    #[serde(rename = "CreateIndex")]
    pub create_index: u64,

    /// ID is a generated UUID for the deployment
    #[serde(rename = "ID")]
    pub id: String,

    /// JobModifyIndex is the ModifyIndex of the job which the deployment is
    /// tracking.
    #[serde(rename = "JobModifyIndex")]
    pub job_modify_index: u64,

    /// JobSpecModifyIndex is the JobModifyIndex of the job which the
    /// deployment is tracking.
    #[serde(rename = "JobSpecModifyIndex")]
    pub job_spec_modify_index: u64,

    /// IsMultiregion specifies if this deployment is part of a multi-region deployment
    #[serde(rename = "IsMultiregion")]
    pub is_multiregion: bool,

    /// Namespace is the namespace the deployment is created in
    #[serde(rename = "Namespace")]
    pub namespace: String,

    /// JobVersion is the version of the job at which the deployment is tracking
    #[serde(rename = "JobVersion")]
    pub job_version: u64,

    #[serde(rename = "ModifyTime")]
    pub modify_time: i64,

    /// JobID is the job the deployment is created for
    #[serde(rename = "JobID")]
    pub job_id: String,

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

    /// StatusDescription allows a human readable description of the deployment
    /// status.
    #[serde(rename = "StatusDescription")]
    pub status_description: String,

    /// JobCreateIndex is the create index of the job which the deployment is
    /// tracking. It is needed so that if the job gets stopped and reran we can
    /// present the correct list of deployments for the job and not old ones.
    #[serde(rename = "JobCreateIndex")]
    pub job_create_index: u64,

    #[serde(rename = "ModifyIndex")]
    pub modify_index: u64,

    /// Creation and modification times, stored as UnixNano
    #[serde(rename = "CreateTime")]
    pub create_time: i64,
}
