#[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 EventsHistogramRequest {
    #[builder(custom(type = super::super::api::Timestamp, convert = Box::new))]
    #[serde(rename = "startInclusive")]
    start_inclusive: Box<super::super::api::Timestamp>,
    #[builder(custom(type = super::super::api::Timestamp, convert = Box::new))]
    #[serde(rename = "endExclusive")]
    end_exclusive: Box<super::super::api::Timestamp>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::HistogramFilterQuery>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "filterQuery", skip_serializing_if = "Option::is_none", default)]
    filter_query: Option<Box<super::HistogramFilterQuery>>,
    #[builder(default, into)]
    #[serde(
        rename = "archivedStatuses",
        skip_serializing_if = "Option::is_none",
        default
    )]
    archived_statuses: Option<
        std::collections::BTreeSet<super::super::api::ArchivedStatus>,
    >,
    #[builder(default, into)]
    #[serde(rename = "numBins", skip_serializing_if = "Option::is_none", default)]
    num_bins: Option<i32>,
    #[builder(default, into)]
    #[serde(rename = "eventLimit", skip_serializing_if = "Option::is_none", default)]
    event_limit: Option<i32>,
}
impl EventsHistogramRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        start_inclusive: super::super::api::Timestamp,
        end_exclusive: super::super::api::Timestamp,
    ) -> Self {
        Self::builder()
            .start_inclusive(start_inclusive)
            .end_exclusive(end_exclusive)
            .build()
    }
    #[inline]
    pub fn start_inclusive(&self) -> &super::super::api::Timestamp {
        &*self.start_inclusive
    }
    #[inline]
    pub fn end_exclusive(&self) -> &super::super::api::Timestamp {
        &*self.end_exclusive
    }
    /// The query to filter the events to be included in the histogram.
    #[inline]
    pub fn filter_query(&self) -> Option<&super::HistogramFilterQuery> {
        self.filter_query.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::api::ArchivedStatus>> {
        self.archived_statuses.as_ref().map(|o| &*o)
    }
    /// Defaults to 100. Throws if larger than 1_000.
    /// The resulting histogram may have fewer bins than requested if the requested time window is too small.
    #[inline]
    pub fn num_bins(&self) -> Option<i32> {
        self.num_bins.as_ref().map(|o| *o)
    }
    /// Limits the number of events to be included in the histogram.
    /// Defaults to 1_000. Throws if larger than 10_000.
    #[inline]
    pub fn event_limit(&self) -> Option<i32> {
        self.event_limit.as_ref().map(|o| *o)
    }
}
