/// Produces a list of ranges for which data does not exist for the specified duration or longer. Increases
/// window size by the specified staleness threshold on both ends to capture edge cases of data not currently
/// in view.
#[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 StaleRanges {
    #[builder(custom(type = super::Series, convert = Box::new))]
    #[serde(rename = "input")]
    input: Box<super::Series>,
    #[builder(custom(type = super::DurationConstant, convert = Box::new))]
    #[serde(rename = "threshold")]
    threshold: Box<super::DurationConstant>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::TimestampConstant>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "startTimestamp", skip_serializing_if = "Option::is_none", default)]
    start_timestamp: Option<Box<super::TimestampConstant>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::TimestampConstant>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "endTimestamp", skip_serializing_if = "Option::is_none", default)]
    end_timestamp: Option<Box<super::TimestampConstant>>,
}
impl StaleRanges {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(input: super::Series, threshold: super::DurationConstant) -> Self {
        Self::builder().input(input).threshold(threshold).build()
    }
    #[inline]
    pub fn input(&self) -> &super::Series {
        &*self.input
    }
    #[inline]
    pub fn threshold(&self) -> &super::DurationConstant {
        &*self.threshold
    }
    /// The start timestamp of the range. If not specified, staleness will automatically use view range start.
    #[inline]
    pub fn start_timestamp(&self) -> Option<&super::TimestampConstant> {
        self.start_timestamp.as_ref().map(|o| &**o)
    }
    #[deprecated(note = "No longer used and will be removed")]
    #[inline]
    pub fn end_timestamp(&self) -> Option<&super::TimestampConstant> {
        self.end_timestamp.as_ref().map(|o| &**o)
    }
}
