// @generated by eql-codegen from the eql-domains catalog — do not edit
//! The generated `DomainPayload` enum — every stored-payload v3 domain in one Rust type. Generated from the catalog; the DomainType trait, the shared newtypes, and the architectural module doc stay hand-written (domain_type.rs / terms.rs / mod.rs).
use super::domain_type::DomainType;
use serde::{Deserialize, Serialize};
/// Every stored-payload v3 domain in one type: one variant per flat
/// scalar domain in `eql-domains::CATALOG` plus the SteVec document
/// (`eql_v3.json`). Generated from the catalog, so it cannot drift
/// when the catalog grows.
///
/// Serialization is exactly the inner struct's (`#[serde(untagged)]`
/// adds no tagging), so typing a payload never changes the wire.
/// Deliberately NO `Deserialize`: cross-token payloads are
/// byte-identical on the wire (see "Why there is no discriminated
/// enum" in the v3 module docs), so a variant is only constructible
/// from a KNOWN domain — [`DomainPayload::parse`] or
/// [`crate::from_v2::from_v2_typed`] — never inferred from bytes.
#[derive(Clone, Debug, PartialEq, Serialize)]
#[serde(untagged)]
pub enum DomainPayload {
    /// The `eql_v3.integer` payload.
    Integer(super::integer::Integer),
    /// The `eql_v3.integer_eq` payload.
    IntegerEq(super::integer::IntegerEq),
    /// The `eql_v3.integer_ord_ore` payload.
    IntegerOrdOre(super::integer::IntegerOrdOre),
    /// The `eql_v3.integer_ord` payload.
    IntegerOrd(super::integer::IntegerOrd),
    /// The `eql_v3.integer_ord_ope` payload.
    IntegerOrdOpe(super::integer::IntegerOrdOpe),
    /// The `eql_v3.smallint` payload.
    Smallint(super::smallint::Smallint),
    /// The `eql_v3.smallint_eq` payload.
    SmallintEq(super::smallint::SmallintEq),
    /// The `eql_v3.smallint_ord_ore` payload.
    SmallintOrdOre(super::smallint::SmallintOrdOre),
    /// The `eql_v3.smallint_ord` payload.
    SmallintOrd(super::smallint::SmallintOrd),
    /// The `eql_v3.smallint_ord_ope` payload.
    SmallintOrdOpe(super::smallint::SmallintOrdOpe),
    /// The `eql_v3.bigint` payload.
    Bigint(super::bigint::Bigint),
    /// The `eql_v3.bigint_eq` payload.
    BigintEq(super::bigint::BigintEq),
    /// The `eql_v3.bigint_ord_ore` payload.
    BigintOrdOre(super::bigint::BigintOrdOre),
    /// The `eql_v3.bigint_ord` payload.
    BigintOrd(super::bigint::BigintOrd),
    /// The `eql_v3.bigint_ord_ope` payload.
    BigintOrdOpe(super::bigint::BigintOrdOpe),
    /// The `eql_v3.date` payload.
    Date(super::date::Date),
    /// The `eql_v3.date_eq` payload.
    DateEq(super::date::DateEq),
    /// The `eql_v3.date_ord_ore` payload.
    DateOrdOre(super::date::DateOrdOre),
    /// The `eql_v3.date_ord` payload.
    DateOrd(super::date::DateOrd),
    /// The `eql_v3.date_ord_ope` payload.
    DateOrdOpe(super::date::DateOrdOpe),
    /// The `eql_v3.timestamp` payload.
    Timestamp(super::timestamp::Timestamp),
    /// The `eql_v3.timestamp_eq` payload.
    TimestampEq(super::timestamp::TimestampEq),
    /// The `eql_v3.timestamp_ord_ore` payload.
    TimestampOrdOre(super::timestamp::TimestampOrdOre),
    /// The `eql_v3.timestamp_ord` payload.
    TimestampOrd(super::timestamp::TimestampOrd),
    /// The `eql_v3.timestamp_ord_ope` payload.
    TimestampOrdOpe(super::timestamp::TimestampOrdOpe),
    /// The `eql_v3.numeric` payload.
    Numeric(super::numeric::Numeric),
    /// The `eql_v3.numeric_eq` payload.
    NumericEq(super::numeric::NumericEq),
    /// The `eql_v3.numeric_ord_ore` payload.
    NumericOrdOre(super::numeric::NumericOrdOre),
    /// The `eql_v3.numeric_ord` payload.
    NumericOrd(super::numeric::NumericOrd),
    /// The `eql_v3.numeric_ord_ope` payload.
    NumericOrdOpe(super::numeric::NumericOrdOpe),
    /// The `eql_v3.text` payload.
    Text(super::text::Text),
    /// The `eql_v3.text_eq` payload.
    TextEq(super::text::TextEq),
    /// The `eql_v3.text_match` payload.
    TextMatch(super::text::TextMatch),
    /// The `eql_v3.text_ord_ore` payload.
    TextOrdOre(super::text::TextOrdOre),
    /// The `eql_v3.text_ord` payload.
    TextOrd(super::text::TextOrd),
    /// The `eql_v3.text_ord_ope` payload.
    TextOrdOpe(super::text::TextOrdOpe),
    /// The `eql_v3.text_search` payload.
    TextSearch(super::text::TextSearch),
    /// The `eql_v3.boolean` payload.
    Boolean(super::boolean::Boolean),
    /// The `eql_v3.real` payload.
    Real(super::real::Real),
    /// The `eql_v3.real_eq` payload.
    RealEq(super::real::RealEq),
    /// The `eql_v3.real_ord_ore` payload.
    RealOrdOre(super::real::RealOrdOre),
    /// The `eql_v3.real_ord` payload.
    RealOrd(super::real::RealOrd),
    /// The `eql_v3.real_ord_ope` payload.
    RealOrdOpe(super::real::RealOrdOpe),
    /// The `eql_v3.double` payload.
    Double(super::double::Double),
    /// The `eql_v3.double_eq` payload.
    DoubleEq(super::double::DoubleEq),
    /// The `eql_v3.double_ord_ore` payload.
    DoubleOrdOre(super::double::DoubleOrdOre),
    /// The `eql_v3.double_ord` payload.
    DoubleOrd(super::double::DoubleOrd),
    /// The `eql_v3.double_ord_ope` payload.
    DoubleOrdOpe(super::double::DoubleOrdOpe),
    /// The `eql_v3.json` payload.
    SteVecDocument(super::jsonb::SteVecDocument),
}
impl DomainPayload {
    /// Strictly parse `value` as `domain`'s payload, KEEPING the
    /// parsed value — the constructor counterpart of
    /// [`DomainType::parse_value`] (which validates and discards).
    /// `domain` is the unqualified name (`"integer_eq"`, `"json"`,
    /// …). `None` when `domain` is not a stored-payload domain (the
    /// SteVec entry/query shapes included); `Some(Err)` when the
    /// strict parse fails (`deny_unknown_fields`, the
    /// `SchemaVersion`/`SteVecForm` pins).
    pub fn parse(
        domain: &str,
        value: &serde_json::Value,
    ) -> Option<Result<Self, serde_json::Error>> {
        match domain {
            "integer" => Some(super::integer::Integer::deserialize(value).map(Self::Integer)),
            "integer_eq" => {
                Some(super::integer::IntegerEq::deserialize(value).map(Self::IntegerEq))
            }
            "integer_ord_ore" => {
                Some(super::integer::IntegerOrdOre::deserialize(value).map(Self::IntegerOrdOre))
            }
            "integer_ord" => {
                Some(super::integer::IntegerOrd::deserialize(value).map(Self::IntegerOrd))
            }
            "integer_ord_ope" => {
                Some(super::integer::IntegerOrdOpe::deserialize(value).map(Self::IntegerOrdOpe))
            }
            "smallint" => Some(super::smallint::Smallint::deserialize(value).map(Self::Smallint)),
            "smallint_eq" => {
                Some(super::smallint::SmallintEq::deserialize(value).map(Self::SmallintEq))
            }
            "smallint_ord_ore" => {
                Some(super::smallint::SmallintOrdOre::deserialize(value).map(Self::SmallintOrdOre))
            }
            "smallint_ord" => {
                Some(super::smallint::SmallintOrd::deserialize(value).map(Self::SmallintOrd))
            }
            "smallint_ord_ope" => {
                Some(super::smallint::SmallintOrdOpe::deserialize(value).map(Self::SmallintOrdOpe))
            }
            "bigint" => Some(super::bigint::Bigint::deserialize(value).map(Self::Bigint)),
            "bigint_eq" => Some(super::bigint::BigintEq::deserialize(value).map(Self::BigintEq)),
            "bigint_ord_ore" => {
                Some(super::bigint::BigintOrdOre::deserialize(value).map(Self::BigintOrdOre))
            }
            "bigint_ord" => Some(super::bigint::BigintOrd::deserialize(value).map(Self::BigintOrd)),
            "bigint_ord_ope" => {
                Some(super::bigint::BigintOrdOpe::deserialize(value).map(Self::BigintOrdOpe))
            }
            "date" => Some(super::date::Date::deserialize(value).map(Self::Date)),
            "date_eq" => Some(super::date::DateEq::deserialize(value).map(Self::DateEq)),
            "date_ord_ore" => {
                Some(super::date::DateOrdOre::deserialize(value).map(Self::DateOrdOre))
            }
            "date_ord" => Some(super::date::DateOrd::deserialize(value).map(Self::DateOrd)),
            "date_ord_ope" => {
                Some(super::date::DateOrdOpe::deserialize(value).map(Self::DateOrdOpe))
            }
            "timestamp" => {
                Some(super::timestamp::Timestamp::deserialize(value).map(Self::Timestamp))
            }
            "timestamp_eq" => {
                Some(super::timestamp::TimestampEq::deserialize(value).map(Self::TimestampEq))
            }
            "timestamp_ord_ore" => Some(
                super::timestamp::TimestampOrdOre::deserialize(value).map(Self::TimestampOrdOre),
            ),
            "timestamp_ord" => {
                Some(super::timestamp::TimestampOrd::deserialize(value).map(Self::TimestampOrd))
            }
            "timestamp_ord_ope" => Some(
                super::timestamp::TimestampOrdOpe::deserialize(value).map(Self::TimestampOrdOpe),
            ),
            "numeric" => Some(super::numeric::Numeric::deserialize(value).map(Self::Numeric)),
            "numeric_eq" => {
                Some(super::numeric::NumericEq::deserialize(value).map(Self::NumericEq))
            }
            "numeric_ord_ore" => {
                Some(super::numeric::NumericOrdOre::deserialize(value).map(Self::NumericOrdOre))
            }
            "numeric_ord" => {
                Some(super::numeric::NumericOrd::deserialize(value).map(Self::NumericOrd))
            }
            "numeric_ord_ope" => {
                Some(super::numeric::NumericOrdOpe::deserialize(value).map(Self::NumericOrdOpe))
            }
            "text" => Some(super::text::Text::deserialize(value).map(Self::Text)),
            "text_eq" => Some(super::text::TextEq::deserialize(value).map(Self::TextEq)),
            "text_match" => Some(super::text::TextMatch::deserialize(value).map(Self::TextMatch)),
            "text_ord_ore" => {
                Some(super::text::TextOrdOre::deserialize(value).map(Self::TextOrdOre))
            }
            "text_ord" => Some(super::text::TextOrd::deserialize(value).map(Self::TextOrd)),
            "text_ord_ope" => {
                Some(super::text::TextOrdOpe::deserialize(value).map(Self::TextOrdOpe))
            }
            "text_search" => {
                Some(super::text::TextSearch::deserialize(value).map(Self::TextSearch))
            }
            "boolean" => Some(super::boolean::Boolean::deserialize(value).map(Self::Boolean)),
            "real" => Some(super::real::Real::deserialize(value).map(Self::Real)),
            "real_eq" => Some(super::real::RealEq::deserialize(value).map(Self::RealEq)),
            "real_ord_ore" => {
                Some(super::real::RealOrdOre::deserialize(value).map(Self::RealOrdOre))
            }
            "real_ord" => Some(super::real::RealOrd::deserialize(value).map(Self::RealOrd)),
            "real_ord_ope" => {
                Some(super::real::RealOrdOpe::deserialize(value).map(Self::RealOrdOpe))
            }
            "double" => Some(super::double::Double::deserialize(value).map(Self::Double)),
            "double_eq" => Some(super::double::DoubleEq::deserialize(value).map(Self::DoubleEq)),
            "double_ord_ore" => {
                Some(super::double::DoubleOrdOre::deserialize(value).map(Self::DoubleOrdOre))
            }
            "double_ord" => Some(super::double::DoubleOrd::deserialize(value).map(Self::DoubleOrd)),
            "double_ord_ope" => {
                Some(super::double::DoubleOrdOpe::deserialize(value).map(Self::DoubleOrdOpe))
            }
            "json" => {
                Some(super::jsonb::SteVecDocument::deserialize(value).map(Self::SteVecDocument))
            }
            _ => None,
        }
    }
    /// The inner payload as a [`DomainType`] trait object.
    pub fn as_domain_type(&self) -> &dyn DomainType {
        match self {
            Self::Integer(payload) => payload,
            Self::IntegerEq(payload) => payload,
            Self::IntegerOrdOre(payload) => payload,
            Self::IntegerOrd(payload) => payload,
            Self::IntegerOrdOpe(payload) => payload,
            Self::Smallint(payload) => payload,
            Self::SmallintEq(payload) => payload,
            Self::SmallintOrdOre(payload) => payload,
            Self::SmallintOrd(payload) => payload,
            Self::SmallintOrdOpe(payload) => payload,
            Self::Bigint(payload) => payload,
            Self::BigintEq(payload) => payload,
            Self::BigintOrdOre(payload) => payload,
            Self::BigintOrd(payload) => payload,
            Self::BigintOrdOpe(payload) => payload,
            Self::Date(payload) => payload,
            Self::DateEq(payload) => payload,
            Self::DateOrdOre(payload) => payload,
            Self::DateOrd(payload) => payload,
            Self::DateOrdOpe(payload) => payload,
            Self::Timestamp(payload) => payload,
            Self::TimestampEq(payload) => payload,
            Self::TimestampOrdOre(payload) => payload,
            Self::TimestampOrd(payload) => payload,
            Self::TimestampOrdOpe(payload) => payload,
            Self::Numeric(payload) => payload,
            Self::NumericEq(payload) => payload,
            Self::NumericOrdOre(payload) => payload,
            Self::NumericOrd(payload) => payload,
            Self::NumericOrdOpe(payload) => payload,
            Self::Text(payload) => payload,
            Self::TextEq(payload) => payload,
            Self::TextMatch(payload) => payload,
            Self::TextOrdOre(payload) => payload,
            Self::TextOrd(payload) => payload,
            Self::TextOrdOpe(payload) => payload,
            Self::TextSearch(payload) => payload,
            Self::Boolean(payload) => payload,
            Self::Real(payload) => payload,
            Self::RealEq(payload) => payload,
            Self::RealOrdOre(payload) => payload,
            Self::RealOrd(payload) => payload,
            Self::RealOrdOpe(payload) => payload,
            Self::Double(payload) => payload,
            Self::DoubleEq(payload) => payload,
            Self::DoubleOrdOre(payload) => payload,
            Self::DoubleOrd(payload) => payload,
            Self::DoubleOrdOpe(payload) => payload,
            Self::SteVecDocument(payload) => payload,
        }
    }
    /// Fully-qualified SQL domain name, e.g. `"eql_v3.integer_eq"`.
    pub fn sql_domain(&self) -> &'static str {
        self.as_domain_type().sql_domain()
    }
    /// Unqualified SQL domain name, e.g. `"integer_eq"` — the name
    /// [`DomainPayload::parse`] accepts.
    pub fn domain(&self) -> &'static str {
        self.as_domain_type().domain()
    }
}
