Skip to main content

things3_cloud/wire/
tombstone.rs

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