#[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 NumericHistogramBucketWidthAndOffset {
    #[builder(custom(type = super::DoubleConstant, convert = Box::new))]
    #[serde(rename = "width")]
    width: Box<super::DoubleConstant>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::DoubleConstant>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "offset", skip_serializing_if = "Option::is_none", default)]
    offset: Option<Box<super::DoubleConstant>>,
}
impl NumericHistogramBucketWidthAndOffset {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(width: super::DoubleConstant) -> Self {
        Self::builder().width(width).build()
    }
    /// The width of each bucket. If offset is not specified, the left and right bounds of each bucket
    /// are multiples of the width. If offset is specified, the left and right bounds of each bucket are
    /// shifted right by the offset value.
    #[inline]
    pub fn width(&self) -> &super::DoubleConstant {
        &*self.width
    }
    /// The rightward shift to apply to the left and right bounds of each bucket. If not specified,
    /// the offset will be 0. The offset must be non-negative.
    #[inline]
    pub fn offset(&self) -> Option<&super::DoubleConstant> {
        self.offset.as_ref().map(|o| &**o)
    }
}
