#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct SearchFilteredChannelsRequest {
    #[builder(default, into)]
    #[serde(rename = "substrings", skip_serializing_if = "Option::is_none", default)]
    substrings: Option<std::collections::BTreeSet<String>>,
    #[builder(default, into)]
    #[serde(rename = "subsequences", skip_serializing_if = "Option::is_none", default)]
    subsequences: Option<std::collections::BTreeSet<String>>,
    #[builder(default, set(item(type = conjure_object::ResourceIdentifier)))]
    #[serde(
        rename = "dataSources",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    data_sources: std::collections::BTreeSet<conjure_object::ResourceIdentifier>,
    #[builder(default, into)]
    #[serde(rename = "resultSize", skip_serializing_if = "Option::is_none", default)]
    result_size: Option<i32>,
    #[builder(
        default,
        map(
            key(type = conjure_object::ResourceIdentifier),
            value(
                custom(
                    type = impl
                    IntoIterator<Item = (String, String)>,
                    convert = |v|v.into_iter().collect()
                )
            )
        )
    )]
    #[serde(
        rename = "tags",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    tags: std::collections::BTreeMap<
        conjure_object::ResourceIdentifier,
        std::collections::BTreeMap<String, String>,
    >,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::scout::run::api::UtcTimestamp>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "minDataUpdatedTime",
        skip_serializing_if = "Option::is_none",
        default
    )]
    min_data_updated_time: Option<
        Box<super::super::super::scout::run::api::UtcTimestamp>,
    >,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::scout::run::api::UtcTimestamp>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "maxDataStartTime",
        skip_serializing_if = "Option::is_none",
        default
    )]
    max_data_start_time: Option<Box<super::super::super::scout::run::api::UtcTimestamp>>,
    #[builder(default, into)]
    #[serde(
        rename = "previouslySelectedChannels",
        skip_serializing_if = "Option::is_none",
        default
    )]
    previously_selected_channels: Option<
        std::collections::BTreeMap<
            conjure_object::ResourceIdentifier,
            std::collections::BTreeSet<String>,
        >,
    >,
    #[builder(default, into)]
    #[serde(
        rename = "fuzzySearchText",
        skip_serializing_if = "Option::is_none",
        default
    )]
    fuzzy_search_text: Option<String>,
    #[builder(default, into)]
    #[serde(rename = "exactMatch", skip_serializing_if = "Option::is_none", default)]
    exact_match: Option<std::collections::BTreeSet<String>>,
}
impl SearchFilteredChannelsRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new() -> Self {
        Self::builder().build()
    }
    /// All of the strings in the set must appear exactly as substrings within the channel name.
    #[inline]
    pub fn substrings(&self) -> Option<&std::collections::BTreeSet<String>> {
        self.substrings.as_ref().map(|o| &*o)
    }
    /// All of the characters in the string will appear in the same order (not necessarily adjacently)
    /// within the channel name. Only supports one subsequence to match at this time.
    #[inline]
    pub fn subsequences(&self) -> Option<&std::collections::BTreeSet<String>> {
        self.subsequences.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn data_sources(
        &self,
    ) -> &std::collections::BTreeSet<conjure_object::ResourceIdentifier> {
        &self.data_sources
    }
    /// Defaults to 200. Will throw if larger than 200.
    #[inline]
    pub fn result_size(&self) -> Option<i32> {
        self.result_size.as_ref().map(|o| *o)
    }
    /// For each data source specified as a key, search will only return channels containing a superset of the
    /// tags specified for that given datasource. If a data source is present in the dataSources field but not
    /// in this map, or if a data source points to an empty map of tags, it will be searched without tag filters.
    #[inline]
    pub fn tags(
        &self,
    ) -> &std::collections::BTreeMap<
        conjure_object::ResourceIdentifier,
        std::collections::BTreeMap<String, String>,
    > {
        &self.tags
    }
    /// If specified, search will only return channels that have had new data after the specified time.
    #[inline]
    pub fn min_data_updated_time(
        &self,
    ) -> Option<&super::super::super::scout::run::api::UtcTimestamp> {
        self.min_data_updated_time.as_ref().map(|o| &**o)
    }
    /// If specified, search will only return channels that have data before the specified time.
    #[inline]
    pub fn max_data_start_time(
        &self,
    ) -> Option<&super::super::super::scout::run::api::UtcTimestamp> {
        self.max_data_start_time.as_ref().map(|o| &**o)
    }
    #[deprecated(note = "Will be ignored.\n")]
    #[inline]
    pub fn previously_selected_channels(
        &self,
    ) -> Option<
        &std::collections::BTreeMap<
            conjure_object::ResourceIdentifier,
            std::collections::BTreeSet<String>,
        >,
    > {
        self.previously_selected_channels.as_ref().map(|o| &*o)
    }
    #[deprecated(note = "Try subsequence search instead.\n")]
    #[inline]
    pub fn fuzzy_search_text(&self) -> Option<&str> {
        self.fuzzy_search_text.as_ref().map(|o| &**o)
    }
    /// Will return only channels that contain all strings specified as exact matches (case insensitive).
    #[deprecated(note = "Try substring search instead.\n")]
    #[inline]
    pub fn exact_match(&self) -> Option<&std::collections::BTreeSet<String>> {
        self.exact_match.as_ref().map(|o| &*o)
    }
}
