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

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

/// ServiceCheck represents a Nomad job-submitters view of a Consul service health check.
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct ServiceCheck {
    #[serde(
        rename = "Args",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub args: Vec<String>,

    #[serde(rename = "Path")]
    pub path: String,

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

    #[serde(rename = "Expose")]
    pub expose: bool,

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

    #[serde(rename = "Command")]
    pub command: String,

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

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

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

    #[serde(rename = "Type")]
    pub r#type: String,

    #[serde(
        rename = "Timeout",
        serialize_with = "crate::serialize_duration",
        deserialize_with = "crate::deserialize_duration"
    )]
    pub timeout: chrono::TimeDelta,

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

    #[serde(rename = "Body")]
    pub body: String,

    #[serde(rename = "Name")]
    pub name: String,

    #[serde(rename = "Advertise")]
    pub advertise: String,

    #[serde(rename = "Notes")]
    pub notes: String,

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

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

    #[serde(rename = "Header")]
    pub header: std::collections::HashMap<String, Vec<String>>,

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

    #[serde(
        rename = "Interval",
        serialize_with = "crate::serialize_duration",
        deserialize_with = "crate::deserialize_duration"
    )]
    pub interval: chrono::TimeDelta,

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

    #[serde(rename = "Protocol")]
    pub protocol: String,

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

    #[serde(rename = "Method")]
    pub method: String,

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

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