#![allow(deprecated)]
use std::fmt;
use std::str;
/// DEPRECATED: apply aggregations as a separate step over the unioned output.
#[derive(
    Debug,
    Clone,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    conjure_object::serde::Deserialize,
    conjure_object::serde::Serialize,
)]
#[serde(crate = "conjure_object::serde")]
pub enum NumericUnionOperation {
    /// Combines multiple points by taking the minimum value
    #[serde(rename = "MIN")]
    Min,
    /// Combines multiple points by taking the maximum value
    #[serde(rename = "MAX")]
    Max,
    /// Combines multiple points by taking the mean of the values
    #[serde(rename = "MEAN")]
    Mean,
    /// Combines multiple points by taking the sum of the values
    #[serde(rename = "SUM")]
    Sum,
    /// Combines multiple points by taking the count of the values
    #[serde(rename = "COUNT")]
    Count,
    /// Combines multiple points by taking the standard deviation of the values
    #[serde(rename = "STANDARD_DEVIATION")]
    StandardDeviation,
    /// Combines multiple points by taking the root mean square of the values
    #[serde(rename = "ROOT_MEAN_SQUARE")]
    RootMeanSquare,
    /// Throws a DuplicateTimestamp error if two series contain points with a duplicate timestamp.
    #[serde(rename = "THROW")]
    Throw,
    /// An unknown variant.
    #[serde(untagged)]
    Unknown(Unknown),
}
impl NumericUnionOperation {
    /// Returns the string representation of the enum.
    #[inline]
    pub fn as_str(&self) -> &str {
        match self {
            NumericUnionOperation::Min => "MIN",
            NumericUnionOperation::Max => "MAX",
            NumericUnionOperation::Mean => "MEAN",
            NumericUnionOperation::Sum => "SUM",
            NumericUnionOperation::Count => "COUNT",
            NumericUnionOperation::StandardDeviation => "STANDARD_DEVIATION",
            NumericUnionOperation::RootMeanSquare => "ROOT_MEAN_SQUARE",
            NumericUnionOperation::Throw => "THROW",
            NumericUnionOperation::Unknown(v) => &*v,
        }
    }
}
impl fmt::Display for NumericUnionOperation {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        fmt::Display::fmt(self.as_str(), fmt)
    }
}
impl conjure_object::Plain for NumericUnionOperation {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        conjure_object::Plain::fmt(self.as_str(), fmt)
    }
}
impl str::FromStr for NumericUnionOperation {
    type Err = conjure_object::plain::ParseEnumError;
    #[inline]
    fn from_str(
        v: &str,
    ) -> Result<NumericUnionOperation, conjure_object::plain::ParseEnumError> {
        match v {
            "MIN" => Ok(NumericUnionOperation::Min),
            "MAX" => Ok(NumericUnionOperation::Max),
            "MEAN" => Ok(NumericUnionOperation::Mean),
            "SUM" => Ok(NumericUnionOperation::Sum),
            "COUNT" => Ok(NumericUnionOperation::Count),
            "STANDARD_DEVIATION" => Ok(NumericUnionOperation::StandardDeviation),
            "ROOT_MEAN_SQUARE" => Ok(NumericUnionOperation::RootMeanSquare),
            "THROW" => Ok(NumericUnionOperation::Throw),
            v => v.parse().map(|v| NumericUnionOperation::Unknown(Unknown(v))),
        }
    }
}
impl conjure_object::FromPlain for NumericUnionOperation {
    type Err = conjure_object::plain::ParseEnumError;
    #[inline]
    fn from_plain(
        v: &str,
    ) -> Result<NumericUnionOperation, conjure_object::plain::ParseEnumError> {
        v.parse()
    }
}
///An unknown variant of the NumericUnionOperation enum.
#[derive(
    Debug,
    Clone,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    conjure_object::serde::Deserialize,
    conjure_object::serde::Serialize,
)]
#[serde(crate = "conjure_object::serde", transparent)]
pub struct Unknown(conjure_object::private::Variant);
impl std::ops::Deref for Unknown {
    type Target = str;
    #[inline]
    fn deref(&self) -> &str {
        &self.0
    }
}
impl fmt::Display for Unknown {
    #[inline]
    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
        fmt::Display::fmt(&self.0, fmt)
    }
}
