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

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

/// StatValue exposes the values of a particular statistic. The value may be of
/// type float, integer, string or boolean. Numeric types can be exposed as a
/// single value or as a fraction.
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct StatValue {
    /// FloatNumeratorVal exposes a floating point value. If denominator is set
    /// it is assumed to be a fractional value, otherwise it is a scalar.
    #[serde(rename = "FloatNumeratorVal", skip_serializing_if = "Option::is_none")]
    pub float_numerator_val: Option<f64>,

    #[serde(
        rename = "FloatDenominatorVal",
        skip_serializing_if = "Option::is_none"
    )]
    pub float_denominator_val: Option<f64>,

    /// IntNumeratorVal exposes a int value. If denominator is set it is assumed
    /// to be a fractional value, otherwise it is a scalar.
    #[serde(rename = "IntNumeratorVal", skip_serializing_if = "Option::is_none")]
    pub int_numerator_val: Option<i64>,

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

    /// StringVal exposes a string value. These are likely annotations.
    #[serde(rename = "StringVal", skip_serializing_if = "Option::is_none")]
    pub string_val: Option<String>,

    /// BoolVal exposes a boolean statistic.
    #[serde(rename = "BoolVal", skip_serializing_if = "Option::is_none")]
    pub bool_val: Option<bool>,

    /// Unit gives the unit type: °F, %, MHz, MB, etc.
    #[serde(rename = "Unit", skip_serializing_if = "Option::is_none")]
    pub unit: Option<String>,

    /// Desc provides a human readable description of the statistic.
    #[serde(rename = "Desc", skip_serializing_if = "Option::is_none")]
    pub desc: Option<String>,
}
