1use serde::Serialize;
2
3use crate::Input;
4
5pub trait Event: Input + Serialize + Send + 'static {
6 const NAME: &'static str;
8}
9
10pub(crate) const PRUNED: &str = "sofie.pruned";
12
13#[cfg(any(feature = "contracts", feature = "publishing", feature = "retention"))]
14pub(crate) fn change_payload(
15 mut fields: serde_json::Map<String, serde_json::Value>,
16 id: sofie_core::Uuid,
17 version: i64,
18) -> serde_json::Map<String, serde_json::Value> {
19 fields.insert("id".to_owned(), serde_json::Value::String(id.to_string()));
20 fields.insert("version".to_owned(), serde_json::Value::from(version));
21 fields
22}
23
24pub(crate) fn is_pruned(payload: &serde_json::Value) -> bool {
25 payload.get(PRUNED) == Some(&serde_json::Value::Bool(true))
26}