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

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

/// TaskEvent is an event that effects the state of a task and contains meta-data
/// appropriate to the events type.
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct TaskEvent {
    #[serde(rename = "RestartReason")]
    pub restart_reason: String,

    #[serde(rename = "KillError")]
    pub kill_error: String,

    #[serde(rename = "DiskLimit")]
    pub disk_limit: i64,

    #[serde(rename = "DiskSize")]
    pub disk_size: i64,

    #[serde(rename = "DisplayMessage")]
    pub display_message: String,

    #[serde(rename = "SetupError")]
    pub setup_error: String,

    #[serde(rename = "DriverError")]
    pub driver_error: String,

    #[serde(rename = "KillReason")]
    pub kill_reason: String,

    #[serde(rename = "VaultError")]
    pub vault_error: String,

    #[serde(rename = "GenericSource")]
    pub generic_source: String,

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

    /// DEPRECATION NOTICE: The following fields are all deprecated. see TaskEvent struct in structs.go for details.
    #[serde(rename = "FailsTask")]
    pub fails_task: bool,

    #[serde(rename = "DownloadError")]
    pub download_error: String,

    #[serde(rename = "ValidationError")]
    pub validation_error: String,

    #[serde(rename = "FailedSibling")]
    pub failed_sibling: String,

    #[serde(rename = "TaskSignalReason")]
    pub task_signal_reason: String,

    #[serde(rename = "Message")]
    pub message: String,

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

    #[serde(rename = "DriverMessage")]
    pub driver_message: String,

    #[serde(rename = "ExitCode")]
    pub exit_code: i64,

    #[serde(rename = "Signal")]
    pub signal: i64,

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

    #[serde(rename = "StartDelay")]
    pub start_delay: i64,

    #[serde(rename = "TaskSignal")]
    pub task_signal: String,

    #[serde(rename = "Time")]
    pub time: i64,
}
