didwebvh_rs/log_entry/
spec_1_0.rs1use chrono::{DateTime, FixedOffset};
4use serde::{Deserialize, Serialize};
5use serde_json::Value;
6
7use crate::{
8 DIDWebVHError,
9 log_entry::{LogEntry, LogEntryCreate, format_version_time, impl_log_entry_common},
10 parameters::{Parameters, spec_1_0::Parameters1_0},
11};
12
13#[derive(Clone, Debug, Deserialize, Serialize)]
16#[serde(rename_all = "camelCase")]
17pub struct LogEntry1_0 {
18 pub version_id: String,
20
21 #[serde(serialize_with = "format_version_time")]
23 pub version_time: DateTime<FixedOffset>,
24
25 pub parameters: Parameters1_0,
27
28 pub state: Value,
30
31 #[serde(skip_serializing_if = "Vec::is_empty", default)]
33 pub proof: Vec<affinidi_data_integrity::DataIntegrityProof>,
34}
35
36impl_log_entry_common!(LogEntry1_0);
37
38impl LogEntryCreate for LogEntry1_0 {
39 fn create(
40 version_id: String,
41 version_time: DateTime<FixedOffset>,
42 parameters: Parameters,
43 state: Value,
44 ) -> Result<LogEntry, DIDWebVHError> {
45 Ok(LogEntry::Spec1_0(LogEntry1_0 {
46 version_id,
47 version_time,
48 parameters: parameters.into(),
49 state,
50 proof: vec![],
51 }))
52 }
53}