#![allow(deprecated)]
use std::fmt;
use std::str;
#[derive(
    Debug,
    Clone,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    conjure_object::serde::Deserialize,
    conjure_object::serde::Serialize,
)]
#[serde(crate = "conjure_object::serde")]
pub enum ValueType {
    #[serde(rename = "NUMERIC_SERIES")]
    NumericSeries,
    #[serde(rename = "ENUM_SERIES")]
    EnumSeries,
    #[serde(rename = "RANGES_SERIES")]
    RangesSeries,
    #[serde(rename = "STRING_CONSTANT")]
    StringConstant,
    #[serde(rename = "DURATION_CONSTANT")]
    DurationConstant,
    #[serde(rename = "TIMESTAMP_CONSTANT")]
    TimestampConstant,
    #[serde(rename = "INTEGER_CONSTANT")]
    IntegerConstant,
    #[serde(rename = "DOUBLE_CONSTANT")]
    DoubleConstant,
    #[serde(rename = "ASSET_RID")]
    AssetRid,
    /// An unknown variant.
    #[serde(untagged)]
    Unknown(Unknown),
}
impl ValueType {
    /// Returns the string representation of the enum.
    #[inline]
    pub fn as_str(&self) -> &str {
        match self {
            ValueType::NumericSeries => "NUMERIC_SERIES",
            ValueType::EnumSeries => "ENUM_SERIES",
            ValueType::RangesSeries => "RANGES_SERIES",
            ValueType::StringConstant => "STRING_CONSTANT",
            ValueType::DurationConstant => "DURATION_CONSTANT",
            ValueType::TimestampConstant => "TIMESTAMP_CONSTANT",
            ValueType::IntegerConstant => "INTEGER_CONSTANT",
            ValueType::DoubleConstant => "DOUBLE_CONSTANT",
            ValueType::AssetRid => "ASSET_RID",
            ValueType::Unknown(v) => &*v,
        }
    }
}
impl fmt::Display for ValueType {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        fmt::Display::fmt(self.as_str(), fmt)
    }
}
impl conjure_object::Plain for ValueType {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        conjure_object::Plain::fmt(self.as_str(), fmt)
    }
}
impl str::FromStr for ValueType {
    type Err = conjure_object::plain::ParseEnumError;
    #[inline]
    fn from_str(v: &str) -> Result<ValueType, conjure_object::plain::ParseEnumError> {
        match v {
            "NUMERIC_SERIES" => Ok(ValueType::NumericSeries),
            "ENUM_SERIES" => Ok(ValueType::EnumSeries),
            "RANGES_SERIES" => Ok(ValueType::RangesSeries),
            "STRING_CONSTANT" => Ok(ValueType::StringConstant),
            "DURATION_CONSTANT" => Ok(ValueType::DurationConstant),
            "TIMESTAMP_CONSTANT" => Ok(ValueType::TimestampConstant),
            "INTEGER_CONSTANT" => Ok(ValueType::IntegerConstant),
            "DOUBLE_CONSTANT" => Ok(ValueType::DoubleConstant),
            "ASSET_RID" => Ok(ValueType::AssetRid),
            v => v.parse().map(|v| ValueType::Unknown(Unknown(v))),
        }
    }
}
impl conjure_object::FromPlain for ValueType {
    type Err = conjure_object::plain::ParseEnumError;
    #[inline]
    fn from_plain(v: &str) -> Result<ValueType, conjure_object::plain::ParseEnumError> {
        v.parse()
    }
}
///An unknown variant of the ValueType 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)
    }
}
