/// Injects tags derived from interval boundaries onto a numeric series. Points within an
/// interval get tagged; points outside all intervals are dropped. Intervals come from either
/// events or ranges. If intervals with different tag map overlap, a data point falling in
/// multiple intervals is duplicated into each matching output group. Overlapping intervals
/// with equal tag maps are not allowed.
/// Optional time shift subtracts a per-interval anchor from timestamps after matching.
#[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 TagByIntervalsSeries {
    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
    #[serde(rename = "input")]
    input: Box<super::NumericSeries>,
    #[builder(custom(type = super::IntervalSource, convert = Box::new))]
    #[serde(rename = "intervals")]
    intervals: Box<super::IntervalSource>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::TagByIntervalsTimeShift>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "timeShift", skip_serializing_if = "Option::is_none", default)]
    time_shift: Option<Box<super::TagByIntervalsTimeShift>>,
}
impl TagByIntervalsSeries {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(input: super::NumericSeries, intervals: super::IntervalSource) -> Self {
        Self::builder().input(input).intervals(intervals).build()
    }
    #[inline]
    pub fn input(&self) -> &super::NumericSeries {
        &*self.input
    }
    #[inline]
    pub fn intervals(&self) -> &super::IntervalSource {
        &*self.intervals
    }
    /// When set, shift each matched point's timestamp by the chosen anchor for that interval.
    #[inline]
    pub fn time_shift(&self) -> Option<&super::TagByIntervalsTimeShift> {
        self.time_shift.as_ref().map(|o| &**o)
    }
}
