use std::collections::BTreeMap;
use crate::types::{Target, TargetType};
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Key {
pub target_type: TargetType,
pub target_value: String,
pub key: String,
}
impl Key {
#[must_use]
pub fn to_target(&self) -> Target {
if self.target_type == TargetType::Project {
Target::project()
} else {
Target::from_parts(self.target_type.clone(), Some(self.target_value.clone()))
}
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum TreeValue {
String(String),
List(Vec<(String, String)>),
Set(BTreeMap<String, String>),
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct Tombstone {
pub timestamp: i64,
pub email: String,
}
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct ParsedTree {
pub values: BTreeMap<Key, TreeValue>,
pub tombstones: BTreeMap<Key, Tombstone>,
pub set_tombstones: BTreeMap<(Key, String), String>,
pub list_tombstones: BTreeMap<(Key, String), Tombstone>,
}