/// Computes the z-score for each series within a group-by family. For each group at each timestamp, the output is
/// (value - mean) / stddev, where mean and stddev are computed across all groups in the family at that timestamp,
/// using the interpolation configuration to align values across groups. When stddev is zero at a timestamp (e.g., all groups have the same value), that data point is excluded from the output.
/// If groupByTags is empty, all groups in the input series will be considered as a single family. This node only
/// produces meaningful results when the input has a group by.
#[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 ZscoreSeries {
    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
    #[serde(rename = "input")]
    input: Box<super::NumericSeries>,
    #[builder(default, set(item(type = super::StringConstant)))]
    #[serde(
        rename = "groupByTags",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    group_by_tags: std::collections::BTreeSet<super::StringConstant>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::InterpolationConfiguration>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "interpolationConfiguration",
        skip_serializing_if = "Option::is_none",
        default
    )]
    interpolation_configuration: Option<Box<super::InterpolationConfiguration>>,
}
impl ZscoreSeries {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(input: super::NumericSeries) -> Self {
        Self::builder().input(input).build()
    }
    #[inline]
    pub fn input(&self) -> &super::NumericSeries {
        &*self.input
    }
    /// Tags to group by for the normalization. If left empty, all groups in the input will be considered as a
    /// single family. Otherwise, inputs will be normalized separately across the groups specified by the tags.
    #[inline]
    pub fn group_by_tags(&self) -> &std::collections::BTreeSet<super::StringConstant> {
        &self.group_by_tags
    }
    /// Configuration for aligning values across groups at each timestamp. Defaults to forward fill interpolation
    /// with a 1s interpolation radius.
    #[deprecated(note = "Setting interpolation on this node is deprecated.\n")]
    #[inline]
    pub fn interpolation_configuration(
        &self,
    ) -> Option<&super::InterpolationConfiguration> {
        self.interpolation_configuration.as_ref().map(|o| &**o)
    }
}
