#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    conjure_object::private::DeriveWith
)]
#[serde(crate = "conjure_object::serde")]
#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct Threshold {
    #[serde(rename = "value")]
    #[derive_with(with = conjure_object::private::DoubleWrapper)]
    value: f64,
    #[serde(rename = "color")]
    color: super::super::super::api::HexColor,
    #[builder(default, into)]
    #[serde(rename = "label", skip_serializing_if = "Option::is_none", default)]
    label: Option<String>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::ThresholdLatch>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "latch", skip_serializing_if = "Option::is_none", default)]
    latch: Option<Box<super::ThresholdLatch>>,
}
impl Threshold {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(value: f64, color: super::super::super::api::HexColor) -> Self {
        Self::builder().value(value).color(color).build()
    }
    /// The minimum value a number must be to trigger the threshold color. If used in a staleness cell, this value is in milliseconds.
    #[inline]
    pub fn value(&self) -> f64 {
        self.value
    }
    /// The color to apply to the cell when the threshold is active.
    #[inline]
    pub fn color(&self) -> &super::super::super::api::HexColor {
        &self.color
    }
    /// A name for this threshold to display while editing.
    #[inline]
    pub fn label(&self) -> Option<&str> {
        self.label.as_ref().map(|o| &**o)
    }
    /// Options for pinning an indicator that data was within the threshold range
    /// while streaming.
    #[inline]
    pub fn latch(&self) -> Option<&super::ThresholdLatch> {
        self.latch.as_ref().map(|o| &**o)
    }
}
