/// Drives point-cloud visibility from the workbook playhead. When enabled,
/// only points with a time attribute value ≤ the mapped playhead position
/// are shown, revealing the cloud progressively as the playhead advances.
#[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 SpatialTimeBinding {
    #[serde(rename = "enabled")]
    enabled: bool,
    #[builder(into)]
    #[serde(rename = "attribute")]
    attribute: String,
    #[serde(rename = "unit")]
    unit: super::SpatialTimeUnit,
    #[builder(default, into)]
    #[serde(
        rename = "relativeStartUs",
        skip_serializing_if = "Option::is_none",
        default
    )]
    relative_start_us: Option<conjure_object::SafeLong>,
    #[builder(default, into)]
    #[serde(rename = "relativeEndUs", skip_serializing_if = "Option::is_none", default)]
    relative_end_us: Option<conjure_object::SafeLong>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::SpatialTimeWindow>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "timeWindow", skip_serializing_if = "Option::is_none", default)]
    time_window: Option<Box<super::SpatialTimeWindow>>,
}
impl SpatialTimeBinding {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        enabled: bool,
        attribute: impl Into<String>,
        unit: super::SpatialTimeUnit,
    ) -> Self {
        Self::builder().enabled(enabled).attribute(attribute).unit(unit).build()
    }
    #[inline]
    pub fn enabled(&self) -> bool {
        self.enabled
    }
    /// Name of the per-point attribute that encodes time (e.g. "timestamp").
    #[inline]
    pub fn attribute(&self) -> &str {
        &*self.attribute
    }
    #[inline]
    pub fn unit(&self) -> &super::SpatialTimeUnit {
        &self.unit
    }
    /// User-supplied start of the point cloud's time range in µs. Used as a
    /// fallback when the ingest pipeline has not yet populated the spatial
    /// asset's relative_start_us property.
    #[inline]
    pub fn relative_start_us(&self) -> Option<conjure_object::SafeLong> {
        self.relative_start_us.as_ref().map(|o| *o)
    }
    /// User-supplied end of the point cloud's time range in µs. Used as a
    /// fallback when the ingest pipeline has not yet populated the spatial
    /// asset's relative_end_us property.
    #[inline]
    pub fn relative_end_us(&self) -> Option<conjure_object::SafeLong> {
        self.relative_end_us.as_ref().map(|o| *o)
    }
    /// Controls which returns are visible relative to the playhead. Defaults to accumulated.
    #[inline]
    pub fn time_window(&self) -> Option<&super::SpatialTimeWindow> {
        self.time_window.as_ref().map(|o| &**o)
    }
}
