/// A bucket in a numeric histogram representing a range of values,
/// and the counts of values in that range across all input series.
#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    conjure_object::private::DeriveWith
)]
#[serde(crate = "conjure_object::serde")]
#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct NumericHistogramBucket {
    #[serde(rename = "lowerBound")]
    #[derive_with(with = conjure_object::private::DoubleWrapper)]
    lower_bound: f64,
    #[serde(rename = "upperBound")]
    #[derive_with(with = conjure_object::private::DoubleWrapper)]
    upper_bound: f64,
    #[builder(
        default,
        map(key(type = super::VariableName), value(type = super::HistogramChannelCount))
    )]
    #[serde(
        rename = "countsByChannel",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    counts_by_channel: std::collections::BTreeMap<
        super::VariableName,
        super::HistogramChannelCount,
    >,
    #[builder(
        default,
        map(key(type = super::VariableName), value(type = super::HistogramChannelCount))
    )]
    #[serde(
        rename = "buckets",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    buckets: std::collections::BTreeMap<
        super::VariableName,
        super::HistogramChannelCount,
    >,
}
impl NumericHistogramBucket {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(lower_bound: f64, upper_bound: f64) -> Self {
        Self::builder().lower_bound(lower_bound).upper_bound(upper_bound).build()
    }
    /// The lower bound of the bucket, inclusive
    #[inline]
    pub fn lower_bound(&self) -> f64 {
        self.lower_bound
    }
    /// The upper bound of the bucket, exclusive
    #[inline]
    pub fn upper_bound(&self) -> f64 {
        self.upper_bound
    }
    #[inline]
    pub fn counts_by_channel(
        &self,
    ) -> &std::collections::BTreeMap<super::VariableName, super::HistogramChannelCount> {
        &self.counts_by_channel
    }
    #[deprecated(note = "Use countsByChannel instead")]
    #[inline]
    pub fn buckets(
        &self,
    ) -> &std::collections::BTreeMap<super::VariableName, super::HistogramChannelCount> {
        &self.buckets
    }
}
