use miette::Result;
use crate::{cases::Articles, id::ID};
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct Sentence {
pub before: String,
pub after: String,
pub article_cases: Articles,
}
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct SavedSentence {
pub id: ID,
pub added: time::OffsetDateTime,
pub sentence: Sentence,
}
impl From<Sentence> for SavedSentence {
fn from(sentence: Sentence) -> Self {
SavedSentence {
id: ID::new(),
added: time::OffsetDateTime::now_utc(),
sentence,
}
}
}
pub trait Repo {
fn save_sentence(self, sentence: SavedSentence) -> Result<()>;
fn all_sentences(self) -> Result<Vec<SavedSentence>>;
}