#[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 QuotaIntervalUsage {
    #[serde(rename = "durationSeconds")]
    duration_seconds: conjure_object::SafeLong,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::QuotaWindow>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "currentWindow", skip_serializing_if = "Option::is_none", default)]
    current_window: Option<Box<super::QuotaWindow>>,
    #[builder(default, list(item(type = super::QuotaResourceUsage)))]
    #[serde(rename = "resources", skip_serializing_if = "Vec::is_empty", default)]
    resources: Vec<super::QuotaResourceUsage>,
}
impl QuotaIntervalUsage {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(duration_seconds: conjure_object::SafeLong) -> Self {
        Self::builder().duration_seconds(duration_seconds).build()
    }
    /// Length of the quota window in seconds.
    #[inline]
    pub fn duration_seconds(&self) -> conjure_object::SafeLong {
        self.duration_seconds
    }
    /// Bounds of the current quota window. Usage counters reset at the window's end.
    #[inline]
    pub fn current_window(&self) -> Option<&super::QuotaWindow> {
        self.current_window.as_ref().map(|o| &**o)
    }
    /// Usage per limited resource. Resources without a configured limit are not reported.
    #[inline]
    pub fn resources(&self) -> &[super::QuotaResourceUsage] {
        &*self.resources
    }
}
