use std::collections::HashMap;
use chrono::Local;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Anatomy {
pub category: String,
pub date_created: String,
pub label: String,
pub last_accessed: Option<String>,
pub tags: Vec<String>,
}
impl Anatomy {
pub fn create_from(category: String, label: String, tags: Vec<String>) -> Self {
Self {
category,
date_created: Local::now().format("%m-%d-%Y %H:%M:%S").to_string(),
label,
last_accessed: None,
tags,
}
}
}
#[derive(Debug, Deserialize, Serialize)]
pub struct LookupTable {
pub table: HashMap<String, Anatomy>,
}
impl LookupTable {
pub fn new() -> LookupTable {
LookupTable {
table: HashMap::new(),
}
}
}
#[derive(Debug, Deserialize, Serialize)]
pub struct LookupMatch {
pub anatomy: Anatomy,
pub hash: String,
}
impl LookupMatch {
pub fn create(anatomy: Anatomy, hash: String) -> Self {
Self { anatomy, hash }
}
}