use std::rc::Rc;
#[derive(Clone, Default, Debug)]
pub struct Grammeme {
pub parent: Option<String>,
pub name: String,
pub alias: String,
pub description: String,
}
#[derive(Clone, Copy, Debug)]
pub enum RestrictionKind {
Maybe,
Obligatory,
Forbidden,
}
#[derive(Clone, Copy, Debug)]
pub enum RestrictionScope {
Lemma,
Form,
}
#[derive(Clone, Debug)]
pub struct Restriction {
pub kind: RestrictionKind,
pub auto: usize,
pub left_scope: RestrictionScope,
pub left_grammeme: Option<Rc<Grammeme>>,
pub right_scope: RestrictionScope,
pub right_grammeme: Option<Rc<Grammeme>>,
}
impl Default for Restriction {
fn default() -> Self {
Restriction{
kind: RestrictionKind::Maybe,
auto: 0,
left_scope: RestrictionScope::Lemma,
left_grammeme: None,
right_scope: RestrictionScope::Lemma,
right_grammeme: None,
}
}
}
#[derive(Clone, Default, Debug)]
pub struct Form {
pub word: String,
pub grammemes: Vec<Rc<Grammeme>>,
}
#[derive(Clone, Default, Debug)]
pub struct Lemma {
pub id: usize,
pub revision: usize,
pub word: String,
pub grammemes: Vec<Rc<Grammeme>>,
pub forms: Vec<Form>,
}
#[derive(Clone, Default, Debug)]
pub struct LinkKind {
pub id: usize,
pub name: String,
}
#[derive(Clone, Default, Debug)]
pub struct Link {
pub id: usize,
pub from: Rc<Lemma>,
pub to: Rc<Lemma>,
pub kind: Rc<LinkKind>,
}
#[derive(Default, Debug)]
pub struct Dict {
pub version: String,
pub revision: usize,
pub grammemes: Vec<Rc<Grammeme>>,
pub restrictions: Vec<Restriction>,
pub lemmata: Vec<Rc<Lemma>>,
pub link_kinds: Vec<Rc<LinkKind>>,
pub links: Vec<Link>,
}