#[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 SearchRunsRequest {
    #[builder(custom(type = super::SortOptions, convert = Box::new))]
    #[serde(rename = "sort")]
    sort: Box<super::SortOptions>,
    #[serde(rename = "pageSize")]
    page_size: i32,
    #[builder(default, into)]
    #[serde(rename = "nextPageToken", skip_serializing_if = "Option::is_none", default)]
    next_page_token: Option<String>,
    #[builder(custom(type = super::SearchQuery, convert = Box::new))]
    #[serde(rename = "query")]
    query: Box<super::SearchQuery>,
    #[builder(default, into)]
    #[serde(
        rename = "archivedStatuses",
        skip_serializing_if = "Option::is_none",
        default
    )]
    archived_statuses: Option<
        std::collections::BTreeSet<super::super::super::super::api::ArchivedStatus>,
    >,
    #[builder(default, into)]
    #[serde(
        rename = "includeMatchCount",
        skip_serializing_if = "Option::is_none",
        default
    )]
    include_match_count: Option<bool>,
}
impl SearchRunsRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        sort: super::SortOptions,
        page_size: i32,
        query: super::SearchQuery,
    ) -> Self {
        Self::builder().sort(sort).page_size(page_size).query(query).build()
    }
    #[inline]
    pub fn sort(&self) -> &super::SortOptions {
        &*self.sort
    }
    /// Will reject page sizes greater than 1000.
    #[inline]
    pub fn page_size(&self) -> i32 {
        self.page_size
    }
    #[inline]
    pub fn next_page_token(&self) -> Option<&str> {
        self.next_page_token.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn query(&self) -> &super::SearchQuery {
        &*self.query
    }
    /// Default search status is NOT_ARCHIVED if none are provided. Allows for including archived runs in search.
    #[deprecated(note = "use archived filter in search query instead.")]
    #[inline]
    pub fn archived_statuses(
        &self,
    ) -> Option<
        &std::collections::BTreeSet<super::super::super::super::api::ArchivedStatus>,
    > {
        self.archived_statuses.as_ref().map(|o| &*o)
    }
    /// When true, the response populates totalCount with the number of runs matching the query. Defaults to
    /// false. Computing the count is an additional query whose cost grows with the size of the matching set, so
    /// only set this when the count is needed.
    #[inline]
    pub fn include_match_count(&self) -> Option<bool> {
        self.include_match_count.as_ref().map(|o| *o)
    }
}
