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

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

/// Job is used to serialize a job.
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct Job {
    #[serde(rename = "vault_token", skip_serializing_if = "Option::is_none")]
    pub vault_token: Option<String>,

    #[serde(rename = "Stop", skip_serializing_if = "Option::is_none")]
    pub stop: Option<bool>,

    #[serde(rename = "ParentID", skip_serializing_if = "Option::is_none")]
    pub parent_id: Option<String>,

    #[serde(
        rename = "DispatchIdempotencyToken",
        skip_serializing_if = "Option::is_none"
    )]
    pub dispatch_idempotency_token: Option<String>,

    #[serde(rename = "Stable", skip_serializing_if = "Option::is_none")]
    pub stable: Option<bool>,

    #[serde(rename = "Name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,

    #[serde(
        rename = "Affinities",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub affinities: Vec<super::Affinity>,

    #[serde(rename = "Migrate", skip_serializing_if = "Option::is_none")]
    pub migrate: Option<super::MigrateStrategy>,

    #[serde(rename = "nomad_token_id", skip_serializing_if = "Option::is_none")]
    pub nomad_token_id: Option<String>,

    #[serde(rename = "all_at_once", skip_serializing_if = "Option::is_none")]
    pub all_at_once: Option<bool>,

    #[serde(
        rename = "Datacenters",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub datacenters: Vec<String>,

    #[serde(rename = "Periodic", skip_serializing_if = "Option::is_none")]
    pub periodic: Option<super::PeriodicConfig>,

    #[serde(rename = "StatusDescription", skip_serializing_if = "Option::is_none")]
    pub status_description: Option<String>,

    #[serde(rename = "JobModifyIndex", skip_serializing_if = "Option::is_none")]
    pub job_modify_index: Option<u64>,

    #[serde(rename = "Namespace", skip_serializing_if = "Option::is_none")]
    pub namespace: Option<String>,

    #[serde(rename = "Priority", skip_serializing_if = "Option::is_none")]
    pub priority: Option<i64>,

    #[serde(rename = "Update", skip_serializing_if = "Option::is_none")]
    pub update: Option<super::UpdateStrategy>,

    #[serde(rename = "Multiregion", skip_serializing_if = "Option::is_none")]
    pub multiregion: Option<super::Multiregion>,

    #[serde(rename = "ParameterizedJob", skip_serializing_if = "Option::is_none")]
    pub parameterized_job: Option<super::ParameterizedJobConfig>,

    #[serde(rename = "node_pool", skip_serializing_if = "Option::is_none")]
    pub node_pool: Option<String>,

    #[serde(rename = "consul_token", skip_serializing_if = "Option::is_none")]
    pub consul_token: Option<String>,

    #[serde(rename = "UI", skip_serializing_if = "Option::is_none")]
    pub ui: Option<super::JobUIConfig>,

    #[serde(rename = "consul_namespace", skip_serializing_if = "Option::is_none")]
    pub consul_namespace: Option<String>,

    #[serde(rename = "CreateIndex", skip_serializing_if = "Option::is_none")]
    pub create_index: Option<u64>,

    #[serde(rename = "ModifyIndex", skip_serializing_if = "Option::is_none")]
    pub modify_index: Option<u64>,

    #[serde(rename = "Meta")]
    pub meta: std::collections::HashMap<String, String>,

    #[serde(rename = "Dispatched")]
    pub dispatched: bool,

    #[serde(
        rename = "Payload",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub payload: Vec<u8>,

    #[serde(rename = "vault_namespace", skip_serializing_if = "Option::is_none")]
    pub vault_namespace: Option<String>,

    #[serde(rename = "Version", skip_serializing_if = "Option::is_none")]
    pub version: Option<u64>,

    #[serde(rename = "VersionTag", skip_serializing_if = "Option::is_none")]
    pub version_tag: Option<super::JobVersionTag>,

    #[serde(rename = "ID", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,

    #[serde(
        rename = "Constraints",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub constraints: Vec<super::Constraint>,

    #[serde(rename = "Status", skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,

    #[serde(rename = "Region", skip_serializing_if = "Option::is_none")]
    pub region: Option<String>,

    #[serde(rename = "Type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<String>,

    #[serde(
        rename = "TaskGroups",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub task_groups: Vec<super::TaskGroup>,

    #[serde(
        rename = "Spreads",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub spreads: Vec<super::Spread>,

    #[serde(rename = "Reschedule", skip_serializing_if = "Option::is_none")]
    pub reschedule: Option<super::ReschedulePolicy>,

    #[serde(rename = "SubmitTime", skip_serializing_if = "Option::is_none")]
    pub submit_time: Option<i64>,
}
