/// Configures how long a condition has to be true for to output a time range, and what to use as the
/// start of the output range. For a point to be included in the output time range, both the minPoints and
/// minDuration conditions must be satisfied.
#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct PersistenceWindowConfiguration {
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::IntegerConstant>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "minPoints", skip_serializing_if = "Option::is_none", default)]
    min_points: Option<Box<super::IntegerConstant>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::DurationConstant>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "minDuration", skip_serializing_if = "Option::is_none", default)]
    min_duration: Option<Box<super::DurationConstant>>,
    #[builder(custom(type = super::OutputRangeStart, convert = Box::new))]
    #[serde(rename = "outputRangeStart")]
    output_range_start: Box<super::OutputRangeStart>,
}
impl PersistenceWindowConfiguration {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(output_range_start: super::OutputRangeStart) -> Self {
        Self::builder().output_range_start(output_range_start).build()
    }
    /// The minimum number of points for which this condition be must satisfied to include the time range in the
    /// output. Must be non-negative. If not present, will default to 1.
    #[inline]
    pub fn min_points(&self) -> Option<&super::IntegerConstant> {
        self.min_points.as_ref().map(|o| &**o)
    }
    /// The minimum number of points for which this condition must be satisfied to include the time range in the
    /// output. Must be non-negative. If not present, will default to 1 nanosecond.
    #[inline]
    pub fn min_duration(&self) -> Option<&super::DurationConstant> {
        self.min_duration.as_ref().map(|o| &**o)
    }
    /// Which point to use as the start of the output range. Defaults to firstPointMatchingCondition if not specified.
    #[inline]
    pub fn output_range_start(&self) -> &super::OutputRangeStart {
        &*self.output_range_start
    }
}
