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    #[serde(rename = "daggerUuid")]
54    dagger_uuid: conjure_object::Uuid,
55    #[builder(custom(type = super::SpatialTypeMetadata, convert = Box::new))]
56    #[serde(rename = "typeMetadata")]
57    type_metadata: Box<super::SpatialTypeMetadata>,
58    #[builder(
59        default,
60        custom(
61            type = impl
62            Into<Option<super::super::super::super::api::Timestamp>>,
63            convert = |v|v.into().map(Box::new)
64        )
65    )]
66    #[serde(rename = "startTimestamp", skip_serializing_if = "Option::is_none", default)]
67    start_timestamp: Option<Box<super::super::super::super::api::Timestamp>>,
68    #[builder(
69        default,
70        custom(
71            type = impl
72            Into<Option<super::super::super::super::api::Timestamp>>,
73            convert = |v|v.into().map(Box::new)
74        )
75    )]
76    #[serde(rename = "endTimestamp", skip_serializing_if = "Option::is_none", default)]
77    end_timestamp: Option<Box<super::super::super::super::api::Timestamp>>,
78    #[builder(
79        default,
80        custom(
81            type = impl
82            Into<Option<super::super::super::super::api::Handle>>,
83            convert = |v|v.into().map(Box::new)
84        )
85    )]
86    #[serde(rename = "sourceHandle", skip_serializing_if = "Option::is_none", default)]
87    source_handle: Option<Box<super::super::super::super::api::Handle>>,
88}
89impl Spatial {
90    /// Unique resource identifier for this spatial asset.
91    #[inline]
92    pub fn rid(&self) -> &super::super::super::super::api::rids::SpatialRid {
93        &self.rid
94    }
95    /// Human-readable name.
96    #[inline]
97    pub fn title(&self) -> &str {
98        &*self.title
99    }
100    /// Optional longer description.
101    #[inline]
102    pub fn description(&self) -> Option<&str> {
103        self.description.as_ref().map(|o| &**o)
104    }
105    /// Labels for categorization and filtering.
106    #[inline]
107    pub fn labels(
108        &self,
109    ) -> &std::collections::BTreeSet<super::super::super::super::api::Label> {
110        &self.labels
111    }
112    /// Arbitrary key-value metadata.
113    #[inline]
114    pub fn properties(
115        &self,
116    ) -> &std::collections::BTreeMap<
117        super::super::super::super::api::PropertyName,
118        super::super::super::super::api::PropertyValue,
119    > {
120        &self.properties
121    }
122    /// RID of the user who created this asset.
123    #[inline]
124    pub fn created_by(&self) -> &conjure_object::ResourceIdentifier {
125        &self.created_by
126    }
127    /// When this asset was created.
128    #[inline]
129    pub fn created_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
130        self.created_at
131    }
132    /// When this asset was last modified.
133    #[inline]
134    pub fn updated_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
135        self.updated_at
136    }
137    /// Whether this asset has been archived.
138    #[inline]
139    pub fn is_archived(&self) -> bool {
140        self.is_archived
141    }
142    /// The UUID of the Dagger model containing this asset's data. Supplied by the caller at create time.
143    #[inline]
144    pub fn dagger_uuid(&self) -> conjure_object::Uuid {
145        self.dagger_uuid
146    }
147    /// Type-specific metadata (e.g. sensor metadata for point clouds). The variant of this
148    /// union also serves as the type discriminator — there is no separate spatialType field.
149    #[inline]
150    pub fn type_metadata(&self) -> &super::SpatialTypeMetadata {
151        &*self.type_metadata
152    }
153    /// Start of the time range covered by this spatial asset.
154    #[inline]
155    pub fn start_timestamp(
156        &self,
157    ) -> Option<&super::super::super::super::api::Timestamp> {
158        self.start_timestamp.as_ref().map(|o| &**o)
159    }
160    /// End of the time range covered by this spatial asset.
161    #[inline]
162    pub fn end_timestamp(&self) -> Option<&super::super::super::super::api::Timestamp> {
163        self.end_timestamp.as_ref().map(|o| &**o)
164    }
165    /// Optional reference to the original source data (e.g., S3 path) for provenance tracking.
166    #[inline]
167    pub fn source_handle(&self) -> Option<&super::super::super::super::api::Handle> {
168        self.source_handle.as_ref().map(|o| &**o)
169    }
170}