#[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 SearchRunChannelsRequest {
    #[builder(into)]
    #[serde(rename = "searchText")]
    search_text: String,
    #[builder(default, into)]
    #[serde(rename = "refNameFilter", skip_serializing_if = "Option::is_none", default)]
    ref_name_filter: Option<
        std::collections::BTreeSet<super::super::super::api::DataSourceRefName>,
    >,
    #[builder(
        default,
        map(
            key(type = super::super::super::api::DataSourceRefName),
            value(
                custom(
                    type = impl
                    IntoIterator<Item = String>,
                    convert = |v|v.into_iter().collect()
                )
            )
        )
    )]
    #[serde(
        rename = "previouslySelectedChannels",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    previously_selected_channels: std::collections::BTreeMap<
        super::super::super::api::DataSourceRefName,
        std::collections::BTreeSet<String>,
    >,
    #[builder(default, into)]
    #[serde(rename = "nextPageToken", skip_serializing_if = "Option::is_none", default)]
    next_page_token: Option<String>,
    #[builder(default, into)]
    #[serde(rename = "pageSize", skip_serializing_if = "Option::is_none", default)]
    page_size: Option<i32>,
}
impl SearchRunChannelsRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(search_text: impl Into<String>) -> Self {
        Self::builder().search_text(search_text).build()
    }
    #[inline]
    pub fn search_text(&self) -> &str {
        &*self.search_text
    }
    /// If not empty, will filter to channels from the selected DataSourceRefNames.
    #[inline]
    pub fn ref_name_filter(
        &self,
    ) -> Option<
        &std::collections::BTreeSet<super::super::super::api::DataSourceRefName>,
    > {
        self.ref_name_filter.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn previously_selected_channels(
        &self,
    ) -> &std::collections::BTreeMap<
        super::super::super::api::DataSourceRefName,
        std::collections::BTreeSet<String>,
    > {
        &self.previously_selected_channels
    }
    #[inline]
    pub fn next_page_token(&self) -> Option<&str> {
        self.next_page_token.as_ref().map(|o| &**o)
    }
    /// Defaults to 1000. Will throw if larger than 1000.
    #[inline]
    pub fn page_size(&self) -> Option<i32> {
        self.page_size.as_ref().map(|o| *o)
    }
}
