use conjure_object::serde::{ser, de};
use conjure_object::serde::ser::SerializeMap as SerializeMap_;
use conjure_object::private::{UnionField_, UnionTypeField_};
use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum SearchQuery {
    Archived(bool),
    /// Search text to perform fuzzy searching against.
    SearchText(String),
    /// Search text to perform exact matching against on the event name and description.
    ExactMatch(String),
    /// Filters to events after this timestamp, exclusive.
    /// This includes events that start before, but end after this time.
    After(super::super::api::Timestamp),
    /// Filters to events before this timestamp, exclusive.
    /// This includes events that start before, but end after this time.
    Before(super::super::api::Timestamp),
    AdvancedTimeFilter(super::EventTimeFilter),
    #[deprecated(note = "use assetRids")]
    Asset(super::super::scout::rids::api::AssetRid),
    Assets(super::AssetsFilter),
    Template(super::super::scout::rids::api::TemplateRid),
    Workbook(super::super::scout::rids::api::NotebookRid),
    #[deprecated(note = "use dataReviews instead")]
    DataReview(super::super::scout::rids::api::DataReviewRid),
    DataReviews(super::DataReviewsFilter),
    #[deprecated(note = "use originTypes instead")]
    OriginType(super::SearchEventOriginType),
    OriginTypes(super::OriginTypesFilter),
    #[deprecated(note = "use dataReviewChecks instead")]
    DataReviewCheck(super::super::scout::rids::api::CheckRid),
    DataReviewChecks(super::DataReviewChecksFilter),
    #[deprecated(note = "use dispositionStatuses instead")]
    DispositionStatus(super::EventDispositionStatus),
    DispositionStatuses(Vec<super::EventDispositionStatus>),
    #[deprecated(note = "use priorities instead")]
    Priority(super::super::scout::api::Priority),
    Priorities(Vec<super::super::scout::api::Priority>),
    #[deprecated(note = "use assignees instead")]
    Assignee(super::super::scout::rids::api::UserRid),
    Assignees(super::AssigneesFilter),
    #[deprecated(note = "use eventTypes instead")]
    EventType(super::EventType),
    EventTypes(Vec<super::EventType>),
    CreatedBy(super::super::scout::rids::api::UserRid),
    CreatedByAnyOf(Vec<super::super::scout::rids::api::UserRid>),
    #[deprecated(note = "use labels instead")]
    Label(String),
    Labels(super::super::scout::rids::api::LabelsFilter),
    #[deprecated(note = "use properties instead")]
    Property(super::super::api::Property),
    Properties(super::super::scout::rids::api::PropertiesFilter),
    And(Vec<super::SearchQuery>),
    Or(Vec<super::SearchQuery>),
    Not(Box<super::SearchQuery>),
    Workspace(conjure_object::ResourceIdentifier),
    Procedure(conjure_object::ResourceIdentifier),
    ProcedureExecution(conjure_object::ResourceIdentifier),
    StepId(String),
    /// Filters to events created from a checklist executing in streaming.
    /// Use `assets` to further filter to a specific streaming checklist instance.
    StreamingChecklist(super::super::scout::rids::api::ChecklistRid),
    /// Filters to events created from the check of a checklist executing in streaming.
    /// Use `assets` to further filter to a specific streaming checklist instance.
    StreamingCheck(super::super::scout::rids::api::CheckRid),
    /// An unknown variant.
    Unknown(Unknown),
}
impl ser::Serialize for SearchQuery {
    fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
    where
        S: ser::Serializer,
    {
        let mut map = s.serialize_map(Some(2))?;
        match self {
            SearchQuery::Archived(value) => {
                map.serialize_entry(&"type", &"archived")?;
                map.serialize_entry(&"archived", value)?;
            }
            SearchQuery::SearchText(value) => {
                map.serialize_entry(&"type", &"searchText")?;
                map.serialize_entry(&"searchText", value)?;
            }
            SearchQuery::ExactMatch(value) => {
                map.serialize_entry(&"type", &"exactMatch")?;
                map.serialize_entry(&"exactMatch", value)?;
            }
            SearchQuery::After(value) => {
                map.serialize_entry(&"type", &"after")?;
                map.serialize_entry(&"after", value)?;
            }
            SearchQuery::Before(value) => {
                map.serialize_entry(&"type", &"before")?;
                map.serialize_entry(&"before", value)?;
            }
            SearchQuery::AdvancedTimeFilter(value) => {
                map.serialize_entry(&"type", &"advancedTimeFilter")?;
                map.serialize_entry(&"advancedTimeFilter", value)?;
            }
            #[allow(deprecated)]
            SearchQuery::Asset(value) => {
                map.serialize_entry(&"type", &"asset")?;
                map.serialize_entry(&"asset", value)?;
            }
            SearchQuery::Assets(value) => {
                map.serialize_entry(&"type", &"assets")?;
                map.serialize_entry(&"assets", value)?;
            }
            SearchQuery::Template(value) => {
                map.serialize_entry(&"type", &"template")?;
                map.serialize_entry(&"template", value)?;
            }
            SearchQuery::Workbook(value) => {
                map.serialize_entry(&"type", &"workbook")?;
                map.serialize_entry(&"workbook", value)?;
            }
            #[allow(deprecated)]
            SearchQuery::DataReview(value) => {
                map.serialize_entry(&"type", &"dataReview")?;
                map.serialize_entry(&"dataReview", value)?;
            }
            SearchQuery::DataReviews(value) => {
                map.serialize_entry(&"type", &"dataReviews")?;
                map.serialize_entry(&"dataReviews", value)?;
            }
            #[allow(deprecated)]
            SearchQuery::OriginType(value) => {
                map.serialize_entry(&"type", &"originType")?;
                map.serialize_entry(&"originType", value)?;
            }
            SearchQuery::OriginTypes(value) => {
                map.serialize_entry(&"type", &"originTypes")?;
                map.serialize_entry(&"originTypes", value)?;
            }
            #[allow(deprecated)]
            SearchQuery::DataReviewCheck(value) => {
                map.serialize_entry(&"type", &"dataReviewCheck")?;
                map.serialize_entry(&"dataReviewCheck", value)?;
            }
            SearchQuery::DataReviewChecks(value) => {
                map.serialize_entry(&"type", &"dataReviewChecks")?;
                map.serialize_entry(&"dataReviewChecks", value)?;
            }
            #[allow(deprecated)]
            SearchQuery::DispositionStatus(value) => {
                map.serialize_entry(&"type", &"dispositionStatus")?;
                map.serialize_entry(&"dispositionStatus", value)?;
            }
            SearchQuery::DispositionStatuses(value) => {
                map.serialize_entry(&"type", &"dispositionStatuses")?;
                map.serialize_entry(&"dispositionStatuses", value)?;
            }
            #[allow(deprecated)]
            SearchQuery::Priority(value) => {
                map.serialize_entry(&"type", &"priority")?;
                map.serialize_entry(&"priority", value)?;
            }
            SearchQuery::Priorities(value) => {
                map.serialize_entry(&"type", &"priorities")?;
                map.serialize_entry(&"priorities", value)?;
            }
            #[allow(deprecated)]
            SearchQuery::Assignee(value) => {
                map.serialize_entry(&"type", &"assignee")?;
                map.serialize_entry(&"assignee", value)?;
            }
            SearchQuery::Assignees(value) => {
                map.serialize_entry(&"type", &"assignees")?;
                map.serialize_entry(&"assignees", value)?;
            }
            #[allow(deprecated)]
            SearchQuery::EventType(value) => {
                map.serialize_entry(&"type", &"eventType")?;
                map.serialize_entry(&"eventType", value)?;
            }
            SearchQuery::EventTypes(value) => {
                map.serialize_entry(&"type", &"eventTypes")?;
                map.serialize_entry(&"eventTypes", value)?;
            }
            SearchQuery::CreatedBy(value) => {
                map.serialize_entry(&"type", &"createdBy")?;
                map.serialize_entry(&"createdBy", value)?;
            }
            SearchQuery::CreatedByAnyOf(value) => {
                map.serialize_entry(&"type", &"createdByAnyOf")?;
                map.serialize_entry(&"createdByAnyOf", value)?;
            }
            #[allow(deprecated)]
            SearchQuery::Label(value) => {
                map.serialize_entry(&"type", &"label")?;
                map.serialize_entry(&"label", value)?;
            }
            SearchQuery::Labels(value) => {
                map.serialize_entry(&"type", &"labels")?;
                map.serialize_entry(&"labels", value)?;
            }
            #[allow(deprecated)]
            SearchQuery::Property(value) => {
                map.serialize_entry(&"type", &"property")?;
                map.serialize_entry(&"property", value)?;
            }
            SearchQuery::Properties(value) => {
                map.serialize_entry(&"type", &"properties")?;
                map.serialize_entry(&"properties", value)?;
            }
            SearchQuery::And(value) => {
                map.serialize_entry(&"type", &"and")?;
                map.serialize_entry(&"and", value)?;
            }
            SearchQuery::Or(value) => {
                map.serialize_entry(&"type", &"or")?;
                map.serialize_entry(&"or", value)?;
            }
            SearchQuery::Not(value) => {
                map.serialize_entry(&"type", &"not")?;
                map.serialize_entry(&"not", value)?;
            }
            SearchQuery::Workspace(value) => {
                map.serialize_entry(&"type", &"workspace")?;
                map.serialize_entry(&"workspace", value)?;
            }
            SearchQuery::Procedure(value) => {
                map.serialize_entry(&"type", &"procedure")?;
                map.serialize_entry(&"procedure", value)?;
            }
            SearchQuery::ProcedureExecution(value) => {
                map.serialize_entry(&"type", &"procedureExecution")?;
                map.serialize_entry(&"procedureExecution", value)?;
            }
            SearchQuery::StepId(value) => {
                map.serialize_entry(&"type", &"stepId")?;
                map.serialize_entry(&"stepId", value)?;
            }
            SearchQuery::StreamingChecklist(value) => {
                map.serialize_entry(&"type", &"streamingChecklist")?;
                map.serialize_entry(&"streamingChecklist", value)?;
            }
            SearchQuery::StreamingCheck(value) => {
                map.serialize_entry(&"type", &"streamingCheck")?;
                map.serialize_entry(&"streamingCheck", value)?;
            }
            SearchQuery::Unknown(value) => {
                map.serialize_entry(&"type", &value.type_)?;
                map.serialize_entry(&value.type_, &value.value)?;
            }
        }
        map.end()
    }
}
impl<'de> de::Deserialize<'de> for SearchQuery {
    fn deserialize<D>(d: D) -> Result<SearchQuery, D::Error>
    where
        D: de::Deserializer<'de>,
    {
        d.deserialize_map(Visitor_)
    }
}
struct Visitor_;
impl<'de> de::Visitor<'de> for Visitor_ {
    type Value = SearchQuery;
    fn expecting(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        fmt.write_str("union SearchQuery")
    }
    fn visit_map<A>(self, mut map: A) -> Result<SearchQuery, A::Error>
    where
        A: de::MapAccess<'de>,
    {
        let v = match map.next_key::<UnionField_<Variant_>>()? {
            Some(UnionField_::Type) => {
                let variant = map.next_value()?;
                let key = map.next_key()?;
                match (variant, key) {
                    (Variant_::Archived, Some(Variant_::Archived)) => {
                        let value = map.next_value()?;
                        SearchQuery::Archived(value)
                    }
                    (Variant_::SearchText, Some(Variant_::SearchText)) => {
                        let value = map.next_value()?;
                        SearchQuery::SearchText(value)
                    }
                    (Variant_::ExactMatch, Some(Variant_::ExactMatch)) => {
                        let value = map.next_value()?;
                        SearchQuery::ExactMatch(value)
                    }
                    (Variant_::After, Some(Variant_::After)) => {
                        let value = map.next_value()?;
                        SearchQuery::After(value)
                    }
                    (Variant_::Before, Some(Variant_::Before)) => {
                        let value = map.next_value()?;
                        SearchQuery::Before(value)
                    }
                    (
                        Variant_::AdvancedTimeFilter,
                        Some(Variant_::AdvancedTimeFilter),
                    ) => {
                        let value = map.next_value()?;
                        SearchQuery::AdvancedTimeFilter(value)
                    }
                    #[allow(deprecated)]
                    (Variant_::Asset, Some(Variant_::Asset)) => {
                        let value = map.next_value()?;
                        SearchQuery::Asset(value)
                    }
                    (Variant_::Assets, Some(Variant_::Assets)) => {
                        let value = map.next_value()?;
                        SearchQuery::Assets(value)
                    }
                    (Variant_::Template, Some(Variant_::Template)) => {
                        let value = map.next_value()?;
                        SearchQuery::Template(value)
                    }
                    (Variant_::Workbook, Some(Variant_::Workbook)) => {
                        let value = map.next_value()?;
                        SearchQuery::Workbook(value)
                    }
                    #[allow(deprecated)]
                    (Variant_::DataReview, Some(Variant_::DataReview)) => {
                        let value = map.next_value()?;
                        SearchQuery::DataReview(value)
                    }
                    (Variant_::DataReviews, Some(Variant_::DataReviews)) => {
                        let value = map.next_value()?;
                        SearchQuery::DataReviews(value)
                    }
                    #[allow(deprecated)]
                    (Variant_::OriginType, Some(Variant_::OriginType)) => {
                        let value = map.next_value()?;
                        SearchQuery::OriginType(value)
                    }
                    (Variant_::OriginTypes, Some(Variant_::OriginTypes)) => {
                        let value = map.next_value()?;
                        SearchQuery::OriginTypes(value)
                    }
                    #[allow(deprecated)]
                    (Variant_::DataReviewCheck, Some(Variant_::DataReviewCheck)) => {
                        let value = map.next_value()?;
                        SearchQuery::DataReviewCheck(value)
                    }
                    (Variant_::DataReviewChecks, Some(Variant_::DataReviewChecks)) => {
                        let value = map.next_value()?;
                        SearchQuery::DataReviewChecks(value)
                    }
                    #[allow(deprecated)]
                    (Variant_::DispositionStatus, Some(Variant_::DispositionStatus)) => {
                        let value = map.next_value()?;
                        SearchQuery::DispositionStatus(value)
                    }
                    (
                        Variant_::DispositionStatuses,
                        Some(Variant_::DispositionStatuses),
                    ) => {
                        let value = map.next_value()?;
                        SearchQuery::DispositionStatuses(value)
                    }
                    #[allow(deprecated)]
                    (Variant_::Priority, Some(Variant_::Priority)) => {
                        let value = map.next_value()?;
                        SearchQuery::Priority(value)
                    }
                    (Variant_::Priorities, Some(Variant_::Priorities)) => {
                        let value = map.next_value()?;
                        SearchQuery::Priorities(value)
                    }
                    #[allow(deprecated)]
                    (Variant_::Assignee, Some(Variant_::Assignee)) => {
                        let value = map.next_value()?;
                        SearchQuery::Assignee(value)
                    }
                    (Variant_::Assignees, Some(Variant_::Assignees)) => {
                        let value = map.next_value()?;
                        SearchQuery::Assignees(value)
                    }
                    #[allow(deprecated)]
                    (Variant_::EventType, Some(Variant_::EventType)) => {
                        let value = map.next_value()?;
                        SearchQuery::EventType(value)
                    }
                    (Variant_::EventTypes, Some(Variant_::EventTypes)) => {
                        let value = map.next_value()?;
                        SearchQuery::EventTypes(value)
                    }
                    (Variant_::CreatedBy, Some(Variant_::CreatedBy)) => {
                        let value = map.next_value()?;
                        SearchQuery::CreatedBy(value)
                    }
                    (Variant_::CreatedByAnyOf, Some(Variant_::CreatedByAnyOf)) => {
                        let value = map.next_value()?;
                        SearchQuery::CreatedByAnyOf(value)
                    }
                    #[allow(deprecated)]
                    (Variant_::Label, Some(Variant_::Label)) => {
                        let value = map.next_value()?;
                        SearchQuery::Label(value)
                    }
                    (Variant_::Labels, Some(Variant_::Labels)) => {
                        let value = map.next_value()?;
                        SearchQuery::Labels(value)
                    }
                    #[allow(deprecated)]
                    (Variant_::Property, Some(Variant_::Property)) => {
                        let value = map.next_value()?;
                        SearchQuery::Property(value)
                    }
                    (Variant_::Properties, Some(Variant_::Properties)) => {
                        let value = map.next_value()?;
                        SearchQuery::Properties(value)
                    }
                    (Variant_::And, Some(Variant_::And)) => {
                        let value = map.next_value()?;
                        SearchQuery::And(value)
                    }
                    (Variant_::Or, Some(Variant_::Or)) => {
                        let value = map.next_value()?;
                        SearchQuery::Or(value)
                    }
                    (Variant_::Not, Some(Variant_::Not)) => {
                        let value = map.next_value()?;
                        SearchQuery::Not(value)
                    }
                    (Variant_::Workspace, Some(Variant_::Workspace)) => {
                        let value = map.next_value()?;
                        SearchQuery::Workspace(value)
                    }
                    (Variant_::Procedure, Some(Variant_::Procedure)) => {
                        let value = map.next_value()?;
                        SearchQuery::Procedure(value)
                    }
                    (
                        Variant_::ProcedureExecution,
                        Some(Variant_::ProcedureExecution),
                    ) => {
                        let value = map.next_value()?;
                        SearchQuery::ProcedureExecution(value)
                    }
                    (Variant_::StepId, Some(Variant_::StepId)) => {
                        let value = map.next_value()?;
                        SearchQuery::StepId(value)
                    }
                    (
                        Variant_::StreamingChecklist,
                        Some(Variant_::StreamingChecklist),
                    ) => {
                        let value = map.next_value()?;
                        SearchQuery::StreamingChecklist(value)
                    }
                    (Variant_::StreamingCheck, Some(Variant_::StreamingCheck)) => {
                        let value = map.next_value()?;
                        SearchQuery::StreamingCheck(value)
                    }
                    (Variant_::Unknown(type_), Some(Variant_::Unknown(b))) => {
                        if type_ == b {
                            let value = map.next_value()?;
                            SearchQuery::Unknown(Unknown { type_, value })
                        } else {
                            return Err(
                                de::Error::invalid_value(de::Unexpected::Str(&type_), &&*b),
                            )
                        }
                    }
                    (variant, Some(key)) => {
                        return Err(
                            de::Error::invalid_value(
                                de::Unexpected::Str(key.as_str()),
                                &variant.as_str(),
                            ),
                        );
                    }
                    (variant, None) => {
                        return Err(de::Error::missing_field(variant.as_str()));
                    }
                }
            }
            Some(UnionField_::Value(variant)) => {
                let value = match &variant {
                    Variant_::Archived => {
                        let value = map.next_value()?;
                        SearchQuery::Archived(value)
                    }
                    Variant_::SearchText => {
                        let value = map.next_value()?;
                        SearchQuery::SearchText(value)
                    }
                    Variant_::ExactMatch => {
                        let value = map.next_value()?;
                        SearchQuery::ExactMatch(value)
                    }
                    Variant_::After => {
                        let value = map.next_value()?;
                        SearchQuery::After(value)
                    }
                    Variant_::Before => {
                        let value = map.next_value()?;
                        SearchQuery::Before(value)
                    }
                    Variant_::AdvancedTimeFilter => {
                        let value = map.next_value()?;
                        SearchQuery::AdvancedTimeFilter(value)
                    }
                    Variant_::Asset => {
                        let value = map.next_value()?;
                        #[allow(deprecated)] SearchQuery::Asset(value)
                    }
                    Variant_::Assets => {
                        let value = map.next_value()?;
                        SearchQuery::Assets(value)
                    }
                    Variant_::Template => {
                        let value = map.next_value()?;
                        SearchQuery::Template(value)
                    }
                    Variant_::Workbook => {
                        let value = map.next_value()?;
                        SearchQuery::Workbook(value)
                    }
                    Variant_::DataReview => {
                        let value = map.next_value()?;
                        #[allow(deprecated)] SearchQuery::DataReview(value)
                    }
                    Variant_::DataReviews => {
                        let value = map.next_value()?;
                        SearchQuery::DataReviews(value)
                    }
                    Variant_::OriginType => {
                        let value = map.next_value()?;
                        #[allow(deprecated)] SearchQuery::OriginType(value)
                    }
                    Variant_::OriginTypes => {
                        let value = map.next_value()?;
                        SearchQuery::OriginTypes(value)
                    }
                    Variant_::DataReviewCheck => {
                        let value = map.next_value()?;
                        #[allow(deprecated)] SearchQuery::DataReviewCheck(value)
                    }
                    Variant_::DataReviewChecks => {
                        let value = map.next_value()?;
                        SearchQuery::DataReviewChecks(value)
                    }
                    Variant_::DispositionStatus => {
                        let value = map.next_value()?;
                        #[allow(deprecated)] SearchQuery::DispositionStatus(value)
                    }
                    Variant_::DispositionStatuses => {
                        let value = map.next_value()?;
                        SearchQuery::DispositionStatuses(value)
                    }
                    Variant_::Priority => {
                        let value = map.next_value()?;
                        #[allow(deprecated)] SearchQuery::Priority(value)
                    }
                    Variant_::Priorities => {
                        let value = map.next_value()?;
                        SearchQuery::Priorities(value)
                    }
                    Variant_::Assignee => {
                        let value = map.next_value()?;
                        #[allow(deprecated)] SearchQuery::Assignee(value)
                    }
                    Variant_::Assignees => {
                        let value = map.next_value()?;
                        SearchQuery::Assignees(value)
                    }
                    Variant_::EventType => {
                        let value = map.next_value()?;
                        #[allow(deprecated)] SearchQuery::EventType(value)
                    }
                    Variant_::EventTypes => {
                        let value = map.next_value()?;
                        SearchQuery::EventTypes(value)
                    }
                    Variant_::CreatedBy => {
                        let value = map.next_value()?;
                        SearchQuery::CreatedBy(value)
                    }
                    Variant_::CreatedByAnyOf => {
                        let value = map.next_value()?;
                        SearchQuery::CreatedByAnyOf(value)
                    }
                    Variant_::Label => {
                        let value = map.next_value()?;
                        #[allow(deprecated)] SearchQuery::Label(value)
                    }
                    Variant_::Labels => {
                        let value = map.next_value()?;
                        SearchQuery::Labels(value)
                    }
                    Variant_::Property => {
                        let value = map.next_value()?;
                        #[allow(deprecated)] SearchQuery::Property(value)
                    }
                    Variant_::Properties => {
                        let value = map.next_value()?;
                        SearchQuery::Properties(value)
                    }
                    Variant_::And => {
                        let value = map.next_value()?;
                        SearchQuery::And(value)
                    }
                    Variant_::Or => {
                        let value = map.next_value()?;
                        SearchQuery::Or(value)
                    }
                    Variant_::Not => {
                        let value = map.next_value()?;
                        SearchQuery::Not(value)
                    }
                    Variant_::Workspace => {
                        let value = map.next_value()?;
                        SearchQuery::Workspace(value)
                    }
                    Variant_::Procedure => {
                        let value = map.next_value()?;
                        SearchQuery::Procedure(value)
                    }
                    Variant_::ProcedureExecution => {
                        let value = map.next_value()?;
                        SearchQuery::ProcedureExecution(value)
                    }
                    Variant_::StepId => {
                        let value = map.next_value()?;
                        SearchQuery::StepId(value)
                    }
                    Variant_::StreamingChecklist => {
                        let value = map.next_value()?;
                        SearchQuery::StreamingChecklist(value)
                    }
                    Variant_::StreamingCheck => {
                        let value = map.next_value()?;
                        SearchQuery::StreamingCheck(value)
                    }
                    Variant_::Unknown(type_) => {
                        let value = map.next_value()?;
                        SearchQuery::Unknown(Unknown {
                            type_: type_.clone(),
                            value,
                        })
                    }
                };
                if map.next_key::<UnionTypeField_>()?.is_none() {
                    return Err(de::Error::missing_field("type"));
                }
                let type_variant = map.next_value::<Variant_>()?;
                if variant != type_variant {
                    return Err(
                        de::Error::invalid_value(
                            de::Unexpected::Str(type_variant.as_str()),
                            &variant.as_str(),
                        ),
                    );
                }
                value
            }
            None => return Err(de::Error::missing_field("type")),
        };
        if map.next_key::<UnionField_<Variant_>>()?.is_some() {
            return Err(de::Error::invalid_length(3, &"type and value fields"));
        }
        Ok(v)
    }
}
#[derive(PartialEq)]
enum Variant_ {
    Archived,
    SearchText,
    ExactMatch,
    After,
    Before,
    AdvancedTimeFilter,
    Asset,
    Assets,
    Template,
    Workbook,
    DataReview,
    DataReviews,
    OriginType,
    OriginTypes,
    DataReviewCheck,
    DataReviewChecks,
    DispositionStatus,
    DispositionStatuses,
    Priority,
    Priorities,
    Assignee,
    Assignees,
    EventType,
    EventTypes,
    CreatedBy,
    CreatedByAnyOf,
    Label,
    Labels,
    Property,
    Properties,
    And,
    Or,
    Not,
    Workspace,
    Procedure,
    ProcedureExecution,
    StepId,
    StreamingChecklist,
    StreamingCheck,
    Unknown(Box<str>),
}
impl Variant_ {
    fn as_str(&self) -> &'static str {
        match *self {
            Variant_::Archived => "archived",
            Variant_::SearchText => "searchText",
            Variant_::ExactMatch => "exactMatch",
            Variant_::After => "after",
            Variant_::Before => "before",
            Variant_::AdvancedTimeFilter => "advancedTimeFilter",
            Variant_::Asset => "asset",
            Variant_::Assets => "assets",
            Variant_::Template => "template",
            Variant_::Workbook => "workbook",
            Variant_::DataReview => "dataReview",
            Variant_::DataReviews => "dataReviews",
            Variant_::OriginType => "originType",
            Variant_::OriginTypes => "originTypes",
            Variant_::DataReviewCheck => "dataReviewCheck",
            Variant_::DataReviewChecks => "dataReviewChecks",
            Variant_::DispositionStatus => "dispositionStatus",
            Variant_::DispositionStatuses => "dispositionStatuses",
            Variant_::Priority => "priority",
            Variant_::Priorities => "priorities",
            Variant_::Assignee => "assignee",
            Variant_::Assignees => "assignees",
            Variant_::EventType => "eventType",
            Variant_::EventTypes => "eventTypes",
            Variant_::CreatedBy => "createdBy",
            Variant_::CreatedByAnyOf => "createdByAnyOf",
            Variant_::Label => "label",
            Variant_::Labels => "labels",
            Variant_::Property => "property",
            Variant_::Properties => "properties",
            Variant_::And => "and",
            Variant_::Or => "or",
            Variant_::Not => "not",
            Variant_::Workspace => "workspace",
            Variant_::Procedure => "procedure",
            Variant_::ProcedureExecution => "procedureExecution",
            Variant_::StepId => "stepId",
            Variant_::StreamingChecklist => "streamingChecklist",
            Variant_::StreamingCheck => "streamingCheck",
            Variant_::Unknown(_) => "unknown variant",
        }
    }
}
impl<'de> de::Deserialize<'de> for Variant_ {
    fn deserialize<D>(d: D) -> Result<Variant_, D::Error>
    where
        D: de::Deserializer<'de>,
    {
        d.deserialize_str(VariantVisitor_)
    }
}
struct VariantVisitor_;
impl<'de> de::Visitor<'de> for VariantVisitor_ {
    type Value = Variant_;
    fn expecting(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        fmt.write_str("string")
    }
    fn visit_str<E>(self, value: &str) -> Result<Variant_, E>
    where
        E: de::Error,
    {
        let v = match value {
            "archived" => Variant_::Archived,
            "searchText" => Variant_::SearchText,
            "exactMatch" => Variant_::ExactMatch,
            "after" => Variant_::After,
            "before" => Variant_::Before,
            "advancedTimeFilter" => Variant_::AdvancedTimeFilter,
            "asset" => Variant_::Asset,
            "assets" => Variant_::Assets,
            "template" => Variant_::Template,
            "workbook" => Variant_::Workbook,
            "dataReview" => Variant_::DataReview,
            "dataReviews" => Variant_::DataReviews,
            "originType" => Variant_::OriginType,
            "originTypes" => Variant_::OriginTypes,
            "dataReviewCheck" => Variant_::DataReviewCheck,
            "dataReviewChecks" => Variant_::DataReviewChecks,
            "dispositionStatus" => Variant_::DispositionStatus,
            "dispositionStatuses" => Variant_::DispositionStatuses,
            "priority" => Variant_::Priority,
            "priorities" => Variant_::Priorities,
            "assignee" => Variant_::Assignee,
            "assignees" => Variant_::Assignees,
            "eventType" => Variant_::EventType,
            "eventTypes" => Variant_::EventTypes,
            "createdBy" => Variant_::CreatedBy,
            "createdByAnyOf" => Variant_::CreatedByAnyOf,
            "label" => Variant_::Label,
            "labels" => Variant_::Labels,
            "property" => Variant_::Property,
            "properties" => Variant_::Properties,
            "and" => Variant_::And,
            "or" => Variant_::Or,
            "not" => Variant_::Not,
            "workspace" => Variant_::Workspace,
            "procedure" => Variant_::Procedure,
            "procedureExecution" => Variant_::ProcedureExecution,
            "stepId" => Variant_::StepId,
            "streamingChecklist" => Variant_::StreamingChecklist,
            "streamingCheck" => Variant_::StreamingCheck,
            value => Variant_::Unknown(value.to_string().into_boxed_str()),
        };
        Ok(v)
    }
}
///An unknown variant of the SearchQuery union.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Unknown {
    type_: Box<str>,
    value: conjure_object::Any,
}
impl Unknown {
    /// Returns the unknown variant's type name.
    #[inline]
    pub fn type_(&self) -> &str {
        &self.type_
    }
}
