#[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 CheckAlertsHistogramRequest {
    #[builder(default, into)]
    #[serde(rename = "numBins", skip_serializing_if = "Option::is_none", default)]
    num_bins: Option<i32>,
    #[builder(default, into)]
    #[serde(rename = "searchText", skip_serializing_if = "Option::is_none", default)]
    search_text: Option<String>,
    #[builder(custom(type = super::HistogramDistributionVariable, convert = Box::new))]
    #[serde(rename = "distributionVariable")]
    distribution_variable: Box<super::HistogramDistributionVariable>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::HistogramSubGroupVariable>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "subGroupVariable",
        skip_serializing_if = "Option::is_none",
        default
    )]
    sub_group_variable: Option<Box<super::HistogramSubGroupVariable>>,
    #[builder(
        custom(type = super::super::super::super::api::Timestamp, convert = Box::new)
    )]
    #[serde(rename = "startTimeAfter")]
    start_time_after: Box<super::super::super::super::api::Timestamp>,
    #[builder(
        custom(type = super::super::super::super::api::Timestamp, convert = Box::new)
    )]
    #[serde(rename = "startTimeBefore")]
    start_time_before: Box<super::super::super::super::api::Timestamp>,
    #[builder(default, into)]
    #[serde(rename = "status", skip_serializing_if = "Option::is_none", default)]
    status: Option<std::collections::BTreeSet<super::CheckAlertStatus>>,
    #[builder(default, into)]
    #[serde(rename = "checkRids", skip_serializing_if = "Option::is_none", default)]
    check_rids: Option<
        std::collections::BTreeSet<super::super::super::rids::api::CheckRid>,
    >,
    #[builder(default, into)]
    #[serde(rename = "dataReviewRids", skip_serializing_if = "Option::is_none", default)]
    data_review_rids: Option<
        std::collections::BTreeSet<super::super::super::rids::api::DataReviewRid>,
    >,
    #[builder(default, into)]
    #[serde(rename = "assigneeRids", skip_serializing_if = "Option::is_none", default)]
    assignee_rids: Option<
        std::collections::BTreeSet<super::super::super::rids::api::UserRid>,
    >,
    #[builder(default, into)]
    #[serde(rename = "priorities", skip_serializing_if = "Option::is_none", default)]
    priorities: Option<std::collections::BTreeSet<super::super::super::api::Priority>>,
    #[builder(default, set(item(type = super::super::super::run::api::RunRid)))]
    #[serde(
        rename = "runRids",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    run_rids: std::collections::BTreeSet<super::super::super::run::api::RunRid>,
    #[builder(default, set(item(type = super::super::super::rids::api::AssetRid)))]
    #[serde(
        rename = "assetRids",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    asset_rids: std::collections::BTreeSet<super::super::super::rids::api::AssetRid>,
    #[builder(default, into)]
    #[serde(
        rename = "pinnedChecklistRefs",
        skip_serializing_if = "Option::is_none",
        default
    )]
    pinned_checklist_refs: Option<
        std::collections::BTreeSet<super::super::super::checks::api::PinnedChecklistRef>,
    >,
    #[builder(default, into)]
    #[serde(rename = "chartRids", skip_serializing_if = "Option::is_none", default)]
    chart_rids: Option<
        std::collections::BTreeSet<super::super::super::rids::api::VersionedVizId>,
    >,
    #[builder(default, into)]
    #[serde(rename = "notebookRids", skip_serializing_if = "Option::is_none", default)]
    notebook_rids: Option<
        std::collections::BTreeSet<super::super::super::rids::api::NotebookRid>,
    >,
    #[builder(default, into)]
    #[serde(rename = "showArchived", skip_serializing_if = "Option::is_none", default)]
    show_archived: Option<bool>,
    #[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>,
    >,
}
impl CheckAlertsHistogramRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        distribution_variable: super::HistogramDistributionVariable,
        start_time_after: super::super::super::super::api::Timestamp,
        start_time_before: super::super::super::super::api::Timestamp,
    ) -> Self {
        Self::builder()
            .distribution_variable(distribution_variable)
            .start_time_after(start_time_after)
            .start_time_before(start_time_before)
            .build()
    }
    /// Defaults to 100. Throws if larger than 1_000.
    #[inline]
    pub fn num_bins(&self) -> Option<i32> {
        self.num_bins.as_ref().map(|o| *o)
    }
    /// Matches on check name
    #[inline]
    pub fn search_text(&self) -> Option<&str> {
        self.search_text.as_ref().map(|o| &**o)
    }
    /// Represents the data points on the x-axis of a histogram.
    #[inline]
    pub fn distribution_variable(&self) -> &super::HistogramDistributionVariable {
        &*self.distribution_variable
    }
    /// The variable that divides the data into distinct groups for comparison within the histogram.
    #[inline]
    pub fn sub_group_variable(&self) -> Option<&super::HistogramSubGroupVariable> {
        self.sub_group_variable.as_ref().map(|o| &**o)
    }
    /// Filters to start times after this time, inclusive.
    #[inline]
    pub fn start_time_after(&self) -> &super::super::super::super::api::Timestamp {
        &*self.start_time_after
    }
    /// Filters to start times before this time, exclusive.
    #[inline]
    pub fn start_time_before(&self) -> &super::super::super::super::api::Timestamp {
        &*self.start_time_before
    }
    #[inline]
    pub fn status(
        &self,
    ) -> Option<&std::collections::BTreeSet<super::CheckAlertStatus>> {
        self.status.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn check_rids(
        &self,
    ) -> Option<&std::collections::BTreeSet<super::super::super::rids::api::CheckRid>> {
        self.check_rids.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn data_review_rids(
        &self,
    ) -> Option<
        &std::collections::BTreeSet<super::super::super::rids::api::DataReviewRid>,
    > {
        self.data_review_rids.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn assignee_rids(
        &self,
    ) -> Option<&std::collections::BTreeSet<super::super::super::rids::api::UserRid>> {
        self.assignee_rids.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn priorities(
        &self,
    ) -> Option<&std::collections::BTreeSet<super::super::super::api::Priority>> {
        self.priorities.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn run_rids(
        &self,
    ) -> &std::collections::BTreeSet<super::super::super::run::api::RunRid> {
        &self.run_rids
    }
    #[inline]
    pub fn asset_rids(
        &self,
    ) -> &std::collections::BTreeSet<super::super::super::rids::api::AssetRid> {
        &self.asset_rids
    }
    #[inline]
    pub fn pinned_checklist_refs(
        &self,
    ) -> Option<
        &std::collections::BTreeSet<super::super::super::checks::api::PinnedChecklistRef>,
    > {
        self.pinned_checklist_refs.as_ref().map(|o| &*o)
    }
    #[deprecated(note = "charts are no longer versioned resources.")]
    #[inline]
    pub fn chart_rids(
        &self,
    ) -> Option<
        &std::collections::BTreeSet<super::super::super::rids::api::VersionedVizId>,
    > {
        self.chart_rids.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn notebook_rids(
        &self,
    ) -> Option<
        &std::collections::BTreeSet<super::super::super::rids::api::NotebookRid>,
    > {
        self.notebook_rids.as_ref().map(|o| &*o)
    }
    /// To be deprecated. Use archivedStatuses instead. If not present, will not show archived data reviews
    /// in search results.
    #[inline]
    pub fn show_archived(&self) -> Option<bool> {
        self.show_archived.as_ref().map(|o| *o)
    }
    /// Filters search on check alerts based on the archived statuses provided.
    /// Default is NOT_ARCHIVED only if none are provided.
    #[inline]
    pub fn archived_statuses(
        &self,
    ) -> Option<
        &std::collections::BTreeSet<super::super::super::super::api::ArchivedStatus>,
    > {
        self.archived_statuses.as_ref().map(|o| &*o)
    }
}
