/// A spatial asset representing 3D or geospatial data (e.g. point clouds).
#[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 Spatial {
    #[serde(rename = "rid")]
    rid: conjure_object::ResourceIdentifier,
    #[builder(into)]
    #[serde(rename = "title")]
    title: String,
    #[builder(default, into)]
    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
    description: Option<String>,
    #[builder(default, set(item(type = String, into)))]
    #[serde(
        rename = "labels",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    labels: std::collections::BTreeSet<String>,
    #[builder(default, map(key(type = String, into), value(type = String, into)))]
    #[serde(
        rename = "properties",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    properties: std::collections::BTreeMap<String, String>,
    #[serde(rename = "createdBy")]
    created_by: conjure_object::ResourceIdentifier,
    #[serde(rename = "createdAt")]
    created_at: conjure_object::DateTime<conjure_object::Utc>,
    #[serde(rename = "updatedAt")]
    updated_at: conjure_object::DateTime<conjure_object::Utc>,
    #[serde(rename = "isArchived")]
    is_archived: bool,
    #[serde(rename = "daggerUuid")]
    dagger_uuid: conjure_object::Uuid,
    #[builder(custom(type = super::SpatialTypeMetadata, convert = Box::new))]
    #[serde(rename = "typeMetadata")]
    type_metadata: Box<super::SpatialTypeMetadata>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::super::api::Timestamp>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "startTimestamp", skip_serializing_if = "Option::is_none", default)]
    start_timestamp: Option<Box<super::super::super::super::api::Timestamp>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::super::api::Timestamp>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "endTimestamp", skip_serializing_if = "Option::is_none", default)]
    end_timestamp: Option<Box<super::super::super::super::api::Timestamp>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::super::api::Handle>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "sourceHandle", skip_serializing_if = "Option::is_none", default)]
    source_handle: Option<Box<super::super::super::super::api::Handle>>,
}
impl Spatial {
    /// Unique resource identifier for this spatial asset.
    #[inline]
    pub fn rid(&self) -> &conjure_object::ResourceIdentifier {
        &self.rid
    }
    /// Human-readable name.
    #[inline]
    pub fn title(&self) -> &str {
        &*self.title
    }
    /// Optional longer description.
    #[inline]
    pub fn description(&self) -> Option<&str> {
        self.description.as_ref().map(|o| &**o)
    }
    /// Labels for categorization and filtering.
    #[inline]
    pub fn labels(&self) -> &std::collections::BTreeSet<String> {
        &self.labels
    }
    /// Arbitrary key-value metadata.
    #[inline]
    pub fn properties(&self) -> &std::collections::BTreeMap<String, String> {
        &self.properties
    }
    /// RID of the user who created this asset.
    #[inline]
    pub fn created_by(&self) -> &conjure_object::ResourceIdentifier {
        &self.created_by
    }
    /// When this asset was created.
    #[inline]
    pub fn created_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
        self.created_at
    }
    /// When this asset was last modified.
    #[inline]
    pub fn updated_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
        self.updated_at
    }
    /// Whether this asset has been archived.
    #[inline]
    pub fn is_archived(&self) -> bool {
        self.is_archived
    }
    /// The UUID of the Dagger model containing this asset's data. Supplied by the caller at create time.
    #[inline]
    pub fn dagger_uuid(&self) -> conjure_object::Uuid {
        self.dagger_uuid
    }
    /// Type-specific metadata (e.g. sensor metadata for point clouds). The variant of this
    /// union also serves as the type discriminator — there is no separate spatialType field.
    #[inline]
    pub fn type_metadata(&self) -> &super::SpatialTypeMetadata {
        &*self.type_metadata
    }
    /// Start of the time range covered by this spatial asset.
    #[inline]
    pub fn start_timestamp(
        &self,
    ) -> Option<&super::super::super::super::api::Timestamp> {
        self.start_timestamp.as_ref().map(|o| &**o)
    }
    /// End of the time range covered by this spatial asset.
    #[inline]
    pub fn end_timestamp(&self) -> Option<&super::super::super::super::api::Timestamp> {
        self.end_timestamp.as_ref().map(|o| &**o)
    }
    /// Optional reference to the original source data (e.g., S3 path) for provenance tracking.
    #[inline]
    pub fn source_handle(&self) -> Option<&super::super::super::super::api::Handle> {
        self.source_handle.as_ref().map(|o| &**o)
    }
}
