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

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

/// AllocationMetric is used to deserialize allocation metrics.
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct AllocationMetric {
    #[serde(rename = "ClassFiltered")]
    pub class_filtered: std::collections::HashMap<String, i64>,

    #[serde(rename = "NodesExhausted")]
    pub nodes_exhausted: i64,

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

    #[serde(rename = "NodesFiltered")]
    pub nodes_filtered: i64,

    #[serde(rename = "NodesAvailable")]
    pub nodes_available: std::collections::HashMap<String, i64>,

    #[serde(rename = "CoalescedFailures")]
    pub coalesced_failures: i64,

    #[serde(rename = "NodesInPool")]
    pub nodes_in_pool: i64,

    #[serde(rename = "ConstraintFiltered")]
    pub constraint_filtered: std::collections::HashMap<String, i64>,

    /// Deprecated, replaced with ScoreMetaData
    #[serde(rename = "Scores")]
    pub scores: std::collections::HashMap<String, f64>,

    #[serde(rename = "DimensionExhausted")]
    pub dimension_exhausted: std::collections::HashMap<String, i64>,

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

    #[serde(rename = "ResourcesExhausted")]
    pub resources_exhausted: std::collections::HashMap<String, super::Resources>,

    #[serde(
        rename = "ScoreMetaData",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub score_meta_data: Vec<super::NodeScoreMeta>,

    #[serde(rename = "NodesEvaluated")]
    pub nodes_evaluated: i64,

    #[serde(rename = "ClassExhausted")]
    pub class_exhausted: std::collections::HashMap<String, i64>,
}
