///|
pub(all) enum CausalOrder {
  Equal
  Before
  After
  Concurrent
} derive(Eq, Debug)

///|
pub fn CausalOrder::name(self : CausalOrder) -> String {
  match self {
    Equal => "equal"
    Before => "before"
    After => "after"
    Concurrent => "concurrent"
  }
}

///|
pub(all) struct ClockEntry {
  node : String
  counter : Int
}

///|
pub fn ClockEntry::new(node : String, counter : Int) -> ClockEntry {
  { node, counter }
}

///|
pub(all) struct CausalEvent {
  id : String
  origin : String
  clock : VectorClock
  payload : String
}

///|
pub fn CausalEvent::new(
  id : String,
  origin : String,
  clock : VectorClock,
  payload : String,
) -> CausalEvent {
  { id, origin, clock, payload }
}