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

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

/// RestartPolicy defines how the Nomad client restarts
/// tasks in a taskgroup when they fail
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct RestartPolicy {
    #[serde(rename = "render_templates", skip_serializing_if = "Option::is_none")]
    pub render_templates: Option<bool>,

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

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

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

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