1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
use chrono::{DateTime, Utc};
use matrix_sdk_base::ruma::OwnedEventId;
use serde::{Deserialize, Serialize};

mod categories;
mod color;
mod display;
mod labels;
mod object_reference;
mod rendering;

pub use categories::{
    CategoriesStateEvent, CategoriesStateEventContent, Category, CategoryBuilder,
};
pub use color::Color;
pub use labels::Labels;
pub use object_reference::{
    CalendarEventAction, ObjRef, ObjRefBuilder, RefDetails, RefDetailsBuilder, TaskAction,
    TaskListAction,
};
pub use rendering::{ActerIcon, BrandLogo, Colorize, ColorizeBuilder, Icon, Position};

pub use display::{Display, DisplayBuilder};

/// Default UTC DateTime Object
pub type UtcDateTime = DateTime<Utc>;

pub type Date = chrono::NaiveDate;

#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "rel_type", rename = "m.reference")]
pub struct Reference {
    /// The event this event references.
    pub event_id: OwnedEventId,
}

impl From<OwnedEventId> for Reference {
    fn from(event_id: OwnedEventId) -> Reference {
        Reference { event_id }
    }
}

#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "rel_type", rename = "m.references")]
pub struct References {
    /// The event this event references.
    pub event_ids: Vec<OwnedEventId>,
}

impl From<OwnedEventId> for References {
    fn from(event_id: OwnedEventId) -> References {
        vec![event_id].into()
    }
}

impl From<Vec<OwnedEventId>> for References {
    fn from(event_ids: Vec<OwnedEventId>) -> References {
        References { event_ids }
    }
}

#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "rel_type", rename = "global.acter.dev.update")]
pub struct Update {
    /// The event this event archives.
    pub event_id: OwnedEventId,
}

impl From<OwnedEventId> for Update {
    fn from(event_id: OwnedEventId) -> Update {
        Update { event_id }
    }
}

#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "rel_type", rename = "global.acter.dev.belongs_to")]
pub struct BelongsTo {
    /// The event this event archives.
    pub event_id: OwnedEventId,
}

impl From<OwnedEventId> for BelongsTo {
    fn from(event_id: OwnedEventId) -> BelongsTo {
        BelongsTo { event_id }
    }
}