use super::schema::{data, meta};
use chrono::NaiveDateTime;
use serde::Serialize;

#[derive(Queryable, Insertable, Serialize, Debug)]
#[table_name = "data"]
pub struct Entry {
    pub identity: Vec<u8>,
    pub entity: Vec<u8>,
    pub entity_searchable: Option<String>,
    pub attribute: String,
    pub value_str: Option<String>,
    pub value_num: Option<f64>,
    pub immutable: bool,
    pub provenance: String,
    pub timestamp: NaiveDateTime,
}

#[derive(Queryable, Insertable, Serialize, Clone, Debug)]
#[table_name = "meta"]
pub struct MetaValue {
    pub id: i32,
    pub key: String,
    pub value: String,
}
