Skip to main content

nominal_api/conjure/objects/scout/spatial/api/
spatial.rs

1/// A spatial asset representing 3D or geospatial data (e.g. point clouds).
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    conjure_object::private::DeriveWith
8)]
9#[serde(crate = "conjure_object::serde")]
10#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[conjure_object::private::staged_builder::staged_builder]
12#[builder(crate = conjure_object::private::staged_builder, update, inline)]
13pub struct Spatial {
14    #[serde(rename = "rid")]
15    rid: super::super::super::super::api::rids::SpatialRid,
16    #[builder(into)]
17    #[serde(rename = "title")]
18    title: String,
19    #[builder(default, into)]
20    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
21    description: Option<String>,
22    #[builder(default, set(item(type = super::super::super::super::api::Label)))]
23    #[serde(
24        rename = "labels",
25        skip_serializing_if = "std::collections::BTreeSet::is_empty",
26        default
27    )]
28    labels: std::collections::BTreeSet<super::super::super::super::api::Label>,
29    #[builder(
30        default,
31        map(
32            key(type = super::super::super::super::api::PropertyName),
33            value(type = super::super::super::super::api::PropertyValue)
34        )
35    )]
36    #[serde(
37        rename = "properties",
38        skip_serializing_if = "std::collections::BTreeMap::is_empty",
39        default
40    )]
41    properties: std::collections::BTreeMap<
42        super::super::super::super::api::PropertyName,
43        super::super::super::super::api::PropertyValue,
44    >,
45    #[serde(rename = "createdBy")]
46    created_by: conjure_object::ResourceIdentifier,
47    #[serde(rename = "createdAt")]
48    created_at: conjure_object::DateTime<conjure_object::Utc>,
49    #[serde(rename = "updatedAt")]
50    updated_at: conjure_object::DateTime<conjure_object::Utc>,
51    #[serde(rename = "isArchived")]
52    is_archived: bool,
53    #[builder(default, into)]
54    #[serde(rename = "daggerUuid", skip_serializing_if = "Option::is_none", default)]
55    dagger_uuid: Option<conjure_object::Uuid>,
56    #[builder(
57        default,
58        custom(
59            type = impl
60            Into<Option<super::super::super::super::api::Timestamp>>,
61            convert = |v|v.into().map(Box::new)
62        )
63    )]
64    #[serde(rename = "startTimestamp", skip_serializing_if = "Option::is_none", default)]
65    start_timestamp: Option<Box<super::super::super::super::api::Timestamp>>,
66    #[builder(
67        default,
68        custom(
69            type = impl
70            Into<Option<super::super::super::super::api::Timestamp>>,
71            convert = |v|v.into().map(Box::new)
72        )
73    )]
74    #[serde(rename = "endTimestamp", skip_serializing_if = "Option::is_none", default)]
75    end_timestamp: Option<Box<super::super::super::super::api::Timestamp>>,
76    #[builder(custom(type = super::SpatialTypeMetadata, convert = Box::new))]
77    #[serde(rename = "typeMetadata")]
78    type_metadata: Box<super::SpatialTypeMetadata>,
79    #[builder(
80        default,
81        custom(
82            type = impl
83            Into<Option<super::super::super::super::api::Handle>>,
84            convert = |v|v.into().map(Box::new)
85        )
86    )]
87    #[serde(rename = "sourceHandle", skip_serializing_if = "Option::is_none", default)]
88    source_handle: Option<Box<super::super::super::super::api::Handle>>,
89}
90impl Spatial {
91    /// Unique resource identifier for this spatial asset.
92    #[inline]
93    pub fn rid(&self) -> &super::super::super::super::api::rids::SpatialRid {
94        &self.rid
95    }
96    /// Human-readable name.
97    #[inline]
98    pub fn title(&self) -> &str {
99        &*self.title
100    }
101    /// Optional longer description.
102    #[inline]
103    pub fn description(&self) -> Option<&str> {
104        self.description.as_ref().map(|o| &**o)
105    }
106    /// Labels for categorization and filtering.
107    #[inline]
108    pub fn labels(
109        &self,
110    ) -> &std::collections::BTreeSet<super::super::super::super::api::Label> {
111        &self.labels
112    }
113    /// Arbitrary key-value metadata.
114    #[inline]
115    pub fn properties(
116        &self,
117    ) -> &std::collections::BTreeMap<
118        super::super::super::super::api::PropertyName,
119        super::super::super::super::api::PropertyValue,
120    > {
121        &self.properties
122    }
123    /// RID of the user who created this asset.
124    #[inline]
125    pub fn created_by(&self) -> &conjure_object::ResourceIdentifier {
126        &self.created_by
127    }
128    /// When this asset was created.
129    #[inline]
130    pub fn created_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
131        self.created_at
132    }
133    /// When this asset was last modified.
134    #[inline]
135    pub fn updated_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
136        self.updated_at
137    }
138    /// Whether this asset has been archived.
139    #[inline]
140    pub fn is_archived(&self) -> bool {
141        self.is_archived
142    }
143    /// The UUID returned by Dagger when the spatial data was ingested.
144    #[inline]
145    pub fn dagger_uuid(&self) -> Option<conjure_object::Uuid> {
146        self.dagger_uuid.as_ref().map(|o| *o)
147    }
148    /// Start of the time range covered by this spatial asset.
149    #[inline]
150    pub fn start_timestamp(
151        &self,
152    ) -> Option<&super::super::super::super::api::Timestamp> {
153        self.start_timestamp.as_ref().map(|o| &**o)
154    }
155    /// End of the time range covered by this spatial asset.
156    #[inline]
157    pub fn end_timestamp(&self) -> Option<&super::super::super::super::api::Timestamp> {
158        self.end_timestamp.as_ref().map(|o| &**o)
159    }
160    /// Type-specific metadata (e.g. sensor metadata for point clouds). The variant of this
161    /// union also serves as the type discriminator — there is no separate spatialType field.
162    #[inline]
163    pub fn type_metadata(&self) -> &super::SpatialTypeMetadata {
164        &*self.type_metadata
165    }
166    /// Optional reference to the original source data (e.g., S3 path) for provenance tracking.
167    #[inline]
168    pub fn source_handle(&self) -> Option<&super::super::super::super::api::Handle> {
169        self.source_handle.as_ref().map(|o| &**o)
170    }
171}