#![allow(deprecated)]
use std::fmt;
use std::str;
/// Compute types that support streaming but only via polling (not real-time appends).
/// Subscriptions with these types will be created successfully, but the frontend should
/// use polling mode instead of expecting append updates.
#[derive(
    Debug,
    Clone,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    conjure_object::serde::Deserialize,
    conjure_object::serde::Serialize,
)]
#[serde(crate = "conjure_object::serde")]
pub enum PollingOnlyComputationType {
    #[serde(rename = "FREQUENCY_DOMAIN")]
    FrequencyDomain,
    #[serde(rename = "PAGE_SUMMARIZATION_STRATEGY")]
    PageSummarizationStrategy,
    #[serde(rename = "TRUNCATE_SUMMARIZATION_STRATEGY")]
    TruncateSummarizationStrategy,
    #[serde(rename = "LOG_SERIES")]
    LogSeries,
    #[serde(rename = "CURVE_FITTING")]
    CurveFitting,
    #[serde(rename = "SIGNAL_FILTER")]
    SignalFilter,
    #[serde(rename = "SCALAR_UDF")]
    ScalarUdf,
    #[serde(rename = "AGGREGATION_UDF")]
    AggregationUdf,
    #[serde(rename = "ARRAY")]
    Array,
    #[serde(rename = "STRUCT")]
    Struct,
    /// An unknown variant.
    #[serde(untagged)]
    Unknown(Unknown),
}
impl PollingOnlyComputationType {
    /// Returns the string representation of the enum.
    #[inline]
    pub fn as_str(&self) -> &str {
        match self {
            PollingOnlyComputationType::FrequencyDomain => "FREQUENCY_DOMAIN",
            PollingOnlyComputationType::PageSummarizationStrategy => {
                "PAGE_SUMMARIZATION_STRATEGY"
            }
            PollingOnlyComputationType::TruncateSummarizationStrategy => {
                "TRUNCATE_SUMMARIZATION_STRATEGY"
            }
            PollingOnlyComputationType::LogSeries => "LOG_SERIES",
            PollingOnlyComputationType::CurveFitting => "CURVE_FITTING",
            PollingOnlyComputationType::SignalFilter => "SIGNAL_FILTER",
            PollingOnlyComputationType::ScalarUdf => "SCALAR_UDF",
            PollingOnlyComputationType::AggregationUdf => "AGGREGATION_UDF",
            PollingOnlyComputationType::Array => "ARRAY",
            PollingOnlyComputationType::Struct => "STRUCT",
            PollingOnlyComputationType::Unknown(v) => &*v,
        }
    }
}
impl fmt::Display for PollingOnlyComputationType {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        fmt::Display::fmt(self.as_str(), fmt)
    }
}
impl conjure_object::Plain for PollingOnlyComputationType {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        conjure_object::Plain::fmt(self.as_str(), fmt)
    }
}
impl str::FromStr for PollingOnlyComputationType {
    type Err = conjure_object::plain::ParseEnumError;
    #[inline]
    fn from_str(
        v: &str,
    ) -> Result<PollingOnlyComputationType, conjure_object::plain::ParseEnumError> {
        match v {
            "FREQUENCY_DOMAIN" => Ok(PollingOnlyComputationType::FrequencyDomain),
            "PAGE_SUMMARIZATION_STRATEGY" => {
                Ok(PollingOnlyComputationType::PageSummarizationStrategy)
            }
            "TRUNCATE_SUMMARIZATION_STRATEGY" => {
                Ok(PollingOnlyComputationType::TruncateSummarizationStrategy)
            }
            "LOG_SERIES" => Ok(PollingOnlyComputationType::LogSeries),
            "CURVE_FITTING" => Ok(PollingOnlyComputationType::CurveFitting),
            "SIGNAL_FILTER" => Ok(PollingOnlyComputationType::SignalFilter),
            "SCALAR_UDF" => Ok(PollingOnlyComputationType::ScalarUdf),
            "AGGREGATION_UDF" => Ok(PollingOnlyComputationType::AggregationUdf),
            "ARRAY" => Ok(PollingOnlyComputationType::Array),
            "STRUCT" => Ok(PollingOnlyComputationType::Struct),
            v => v.parse().map(|v| PollingOnlyComputationType::Unknown(Unknown(v))),
        }
    }
}
impl conjure_object::FromPlain for PollingOnlyComputationType {
    type Err = conjure_object::plain::ParseEnumError;
    #[inline]
    fn from_plain(
        v: &str,
    ) -> Result<PollingOnlyComputationType, conjure_object::plain::ParseEnumError> {
        v.parse()
    }
}
///An unknown variant of the PollingOnlyComputationType 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)
    }
}
