#[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 SearchMetadataRequest {
    #[builder(default, into)]
    #[serde(rename = "resourceTypes", skip_serializing_if = "Option::is_none", default)]
    resource_types: Option<std::collections::BTreeSet<super::ResourceType>>,
    #[builder(default, into)]
    #[serde(rename = "workspaces", skip_serializing_if = "Option::is_none", default)]
    workspaces: Option<std::collections::BTreeSet<conjure_object::ResourceIdentifier>>,
    #[builder(default, into)]
    #[serde(rename = "searchText", skip_serializing_if = "Option::is_none", default)]
    search_text: Option<String>,
    #[builder(default, into)]
    #[serde(rename = "pageSize", skip_serializing_if = "Option::is_none", default)]
    page_size: Option<i32>,
    #[builder(default, into)]
    #[serde(rename = "pageToken", skip_serializing_if = "Option::is_none", default)]
    page_token: Option<String>,
    #[serde(rename = "sortBy")]
    sort_by: super::MetadataSortField,
    #[builder(default, into)]
    #[serde(rename = "descending", skip_serializing_if = "Option::is_none", default)]
    descending: Option<bool>,
}
impl SearchMetadataRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(sort_by: super::MetadataSortField) -> Self {
        Self::builder().sort_by(sort_by).build()
    }
    /// If omitted, all resource types are included.
    #[inline]
    pub fn resource_types(
        &self,
    ) -> Option<&std::collections::BTreeSet<super::ResourceType>> {
        self.resource_types.as_ref().map(|o| &*o)
    }
    /// If omitted, results will come from all workspaces the user belongs to.
    #[inline]
    pub fn workspaces(
        &self,
    ) -> Option<&std::collections::BTreeSet<conjure_object::ResourceIdentifier>> {
        self.workspaces.as_ref().map(|o| &*o)
    }
    /// Case-insensitive substring filter.
    #[inline]
    pub fn search_text(&self) -> Option<&str> {
        self.search_text.as_ref().map(|o| &**o)
    }
    /// Maximum number of items per page. Defaults to 1000 if not specified.
    #[inline]
    pub fn page_size(&self) -> Option<i32> {
        self.page_size.as_ref().map(|o| *o)
    }
    /// Token for fetching the next page of results.
    #[inline]
    pub fn page_token(&self) -> Option<&str> {
        self.page_token.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn sort_by(&self) -> &super::MetadataSortField {
        &self.sort_by
    }
    /// If true, sort in descending order. Defaults to false.
    #[inline]
    pub fn descending(&self) -> Option<bool> {
        self.descending.as_ref().map(|o| *o)
    }
}
