#[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 ThresholdingRangesNode {
    #[builder(custom(type = super::NumericSeriesNode, convert = Box::new))]
    #[serde(rename = "input")]
    input: Box<super::NumericSeriesNode>,
    #[serde(rename = "threshold")]
    #[derive_with(with = conjure_object::private::DoubleWrapper)]
    threshold: f64,
    #[serde(rename = "operator")]
    operator: super::super::ThresholdOperator,
    #[builder(default, into)]
    #[serde(rename = "minPoints", skip_serializing_if = "Option::is_none", default)]
    min_points: Option<i32>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::super::run::api::Duration>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "minDuration", skip_serializing_if = "Option::is_none", default)]
    min_duration: Option<Box<super::super::super::super::run::api::Duration>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::PersistenceWindowConfiguration>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "persistenceWindowConfiguration",
        skip_serializing_if = "Option::is_none",
        default
    )]
    persistence_window_configuration: Option<Box<super::PersistenceWindowConfiguration>>,
}
impl ThresholdingRangesNode {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        input: super::NumericSeriesNode,
        threshold: f64,
        operator: super::super::ThresholdOperator,
    ) -> Self {
        Self::builder().input(input).threshold(threshold).operator(operator).build()
    }
    #[inline]
    pub fn input(&self) -> &super::NumericSeriesNode {
        &*self.input
    }
    #[inline]
    pub fn threshold(&self) -> f64 {
        self.threshold
    }
    #[inline]
    pub fn operator(&self) -> &super::super::ThresholdOperator {
        &self.operator
    }
    /// The minimum number of points for which this condition is satisfied. Must be non-negative. If not present,
    /// will default to 1.
    #[deprecated(note = "Use persistenceWindowConfiguration instead.")]
    #[inline]
    pub fn min_points(&self) -> Option<i32> {
        self.min_points.as_ref().map(|o| *o)
    }
    /// The minimum duration for which this condition is satisfied. Must be non-negative. If not present, will
    /// default to 1 nanosecond.
    #[deprecated(note = "Use persistenceWindowConfiguration instead.")]
    #[inline]
    pub fn min_duration(
        &self,
    ) -> Option<&super::super::super::super::run::api::Duration> {
        self.min_duration.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn persistence_window_configuration(
        &self,
    ) -> Option<&super::PersistenceWindowConfiguration> {
        self.persistence_window_configuration.as_ref().map(|o| &**o)
    }
}
