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

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

/// UpdateStrategy defines a task groups update strategy.
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct UpdateStrategy {
    #[serde(rename = "health_check", skip_serializing_if = "Option::is_none")]
    pub health_check: Option<String>,

    #[serde(
        rename = "progress_deadline",
        skip_serializing_if = "Option::is_none",
        serialize_with = "crate::serialize_duration_option",
        deserialize_with = "crate::deserialize_duration_option",
        default
    )]
    pub progress_deadline: Option<chrono::TimeDelta>,

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

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

    #[serde(
        rename = "min_healthy_time",
        skip_serializing_if = "Option::is_none",
        serialize_with = "crate::serialize_duration_option",
        deserialize_with = "crate::deserialize_duration_option",
        default
    )]
    pub min_healthy_time: Option<chrono::TimeDelta>,

    #[serde(
        rename = "healthy_deadline",
        skip_serializing_if = "Option::is_none",
        serialize_with = "crate::serialize_duration_option",
        deserialize_with = "crate::deserialize_duration_option",
        default
    )]
    pub healthy_deadline: Option<chrono::TimeDelta>,

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

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

    #[serde(
        rename = "stagger",
        skip_serializing_if = "Option::is_none",
        serialize_with = "crate::serialize_duration_option",
        deserialize_with = "crate::deserialize_duration_option",
        default
    )]
    pub stagger: Option<chrono::TimeDelta>,
}
