Skip to main content

things3_cloud/wire/
tombstone.rs

1use crate::ids::ThingsId;
2use serde::{Deserialize, Serialize};
3use serde_json::Value;
4use std::collections::BTreeMap;
5
6/// Tombstone properties that mark a deleted object.
7#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
8pub struct TombstoneProps {
9    /// `dloid`: deleted object UUID.
10    #[serde(rename = "dloid")]
11    pub deleted_object_id: ThingsId,
12
13    /// `dld`: deletion timestamp.
14    #[serde(rename = "dld", default)]
15    pub delete_date: Option<f64>,
16}
17
18impl Default for TombstoneProps {
19    fn default() -> Self {
20        Self {
21            deleted_object_id: ThingsId::default(),
22            delete_date: None,
23        }
24    }
25}
26
27/// One-shot command properties.
28#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
29pub struct CommandProps {
30    /// `tp`: command type.
31    #[serde(rename = "tp", default)]
32    pub command_type: i32,
33
34    /// `cd`: creation timestamp.
35    #[serde(rename = "cd", default)]
36    pub creation_date: Option<i64>,
37
38    /// `if`: initial field payload for command execution.
39    #[serde(rename = "if", default)]
40    pub initial_fields: Option<BTreeMap<String, Value>>,
41}