/// A bucket in an enum histogram representing all the counts
/// for a specific enumerated value, across all input series.
#[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 EnumHistogramBucket {
    #[builder(into)]
    #[serde(rename = "value")]
    value: String,
    #[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,
    >,
}
impl EnumHistogramBucket {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(value: impl Into<String>) -> Self {
        Self::builder().value(value).build()
    }
    /// The value of the enum as a string
    #[inline]
    pub fn value(&self) -> &str {
        &*self.value
    }
    #[inline]
    pub fn counts_by_channel(
        &self,
    ) -> &std::collections::BTreeMap<super::VariableName, super::HistogramChannelCount> {
        &self.counts_by_channel
    }
}
