use autosurgeon::{
Hydrate,
Reconcile,
};
mod patch;
pub use patch::Patch;
mod time;
pub use time::Timestamp;
#[cfg(test)]
mod tests;
#[derive(Clone, Debug, Reconcile, Hydrate)]
pub struct Discussion {
pub id: u64,
pub topic: String,
pub tags: Vec<Tag>,
pub entries: Vec<Entry>,
}
#[derive(Clone, Debug, Reconcile, Hydrate)]
pub struct Tag {
pub text: String,
pub color: String,
}
#[derive(Clone, Debug, Reconcile, Hydrate)]
pub struct Entry {
pub meta: EntryMeta,
pub kind: EntryKind,
}
#[derive(Clone, Debug, Reconcile, Hydrate)]
pub struct EntryMeta {
pub identity: String,
pub timestamp: Timestamp,
}
impl From<&str> for EntryMeta {
fn from(identity: &str) -> Self {
Self {
identity: identity.to_owned(),
timestamp: Timestamp::now(),
}
}
}
#[derive(Clone, Debug, Reconcile, Hydrate)]
pub enum EntryKind {
Comment(String),
Patch(Patch),
}