from pydantic import BaseModel, Field


class ParadigmPart(BaseModel):
    """
    Paradigm part model.
    """

    #: The paradigm ID.
    para_id: str
    #: The prefix.
    prefix: str
    #: The pre-vowel.
    pre_vowel: str
    #: The vowel.
    vowel: str
    #: The post-vowel.
    post_vowel: str
    #: The boundary.
    boundary: str
    #: The dental.
    dental: str
    #: The ending.
    ending: str


class ParadigmVariant(BaseModel):
    """
    Paradigm variant model.
    """

    #: The variant ID.
    variant_id: int
    #: The parts: the parts of the variant.
    parts: dict[str, ParadigmPart] = Field(default_factory=dict)


class VerbParadigm(BaseModel):
    """
    Verb paradigm model.
    """

    #: The ID.
    ID: str
    #: The title.
    title: str
    #: The verb type.
    type: str
    #: The verb class.
    class_: str = Field(alias="class")
    #: The subdivision.
    subdivision: str
    #: The verb subclass.
    subclass: str
    #: The Wright's analysis of the word.
    wright: str
    #: The variants: the variants of the verb paradigm.
    variants: list[ParadigmVariant] = Field(default_factory=list)


class Word(BaseModel):
    """
    Word model.
    """

    #: The ID.
    nid: int
    #: The title.
    title: str
    #: The Wright's analysis of the word.
    wright: str
    #: The noun.
    noun: int
    #: The pronoun.
    pronoun: int
    #: The adjective.
    adjective: int
    #: The verb.
    verb: int
    #: The participle.
    participle: int | None
    #: The present simple part.
    pspart: int
    #: The past participle part.
    papart: int
    #: The adverb.
    adverb: int
    #: The preposition.
    preposition: int
    #: The conjunction.
    conjunction: int
    #: The interjection.
    interjection: int
    #: The numeral.
    numeral: int
    #: The weak verb.
    vb_weak: int
    #: The weak verb.
    vb_strong: int
    #: The contracted verb.
    vb_contracted: int
    #: The pretpres verb.
    vb_pretpres: int
    #: The anomalous verb.
    vb_anomalous: int
    #: The uncertain verb.
    vb_uncertain: int
    #: The masculine noun.
    n_masc: int
    #: The feminine noun.
    n_fem: int
    #: The neuter noun.
    n_neut: int
    #: The uncertain noun.
    n_uncert: int

    # ------------------------------------------------------------
    # Dynamic fields set during processing
    # ------------------------------------------------------------

    #: The verb paradigm: the paradigm of the verb.
    vb_paradigm: list[VerbParadigm] = Field(default_factory=list)
    #: The adjective paradigm: the paradigm of the adjective.
    adj_paradigm: list[str] = Field(default_factory=list)
    #: The noun paradigm: the paradigm of the noun.
    noun_paradigm: list[str] = Field(default_factory=list)
    #: The syllables: the number of syllables in the word.
    syllables: int = 0
    #: The prefix: the prefix of the word.
    prefix: str = "0"
    #: The long stem: whether the word has a long stem.
    long_stem: int = 0
    #: The stem: the root of the word.
    stem: str = ""


class ManualForm(BaseModel):
    """
    Manual form model.  This is used to store the manual forms of the word,
    which are not generated by the generator, but instead are provided by
    the manual_forms.txt file.
    """

    #: The BT: the base form of the word.
    BT: str
    #: The title: the word itself.
    title: str
    #: The stem: the root of the word.
    stem: str
    #: The form: the form of the word, meaning the form of the word in the dictionary.
    form: str
    #: The form parts: the parts of the form.
    form_parts: str
    #: The variant: the variant of the word.
    var: str
    #: The probability:
    probability: str
    #: The function: the function of the word.
    function: str
    #: The Wright: the Wright's analysis of the word.
    wright: str
    #: The paradigm: the paradigm of the word, meaning the principal parts of the verb.
    paradigm: str
    #: The paradigm ID: the ID of the paradigm.
    para_id: str
    #: The word class: the class of the word.
    wordclass: str
    #: The class 1: the first class of the word, used for verbs.
    class1: str
    #: The class 2: the second class of the word, used for nouns.
    class2: str
    #: The class 3: the third class of the word, used for adjectives.
    class3: str
    #: The comment.
    comment: str


class GeneratedForm(BaseModel):
    """
    Generated form model.
    """

    #: The counter, used to count the number of generated forms.
    counter: int
    #: The form ID, used to identify the form.
    formi: str
    #: The BT: the base form of the word.
    BT: str
    #: The title: the word itself.
    title: str
    #: The stem: the root of the word.
    stem: str
    #: The form: the form of the word, meaning the form of the word in the dictionary.
    form: str
    #: The form parts: the parts of the form.
    form_parts: str
    #: The variant: the variant of the word.
    var: str
    #: The probability.
    probability: str
    #: The function
    function: str
    #: The Wright.
    wright: str
    #: The paradigm.
    paradigm: str
    #: The paradigm ID.
    para_id: str
    #: The word class.
    wordclass: str
    #: The class 1.
    class1: str
    #: The class 2.
    class2: str
    #: The class 3.
    class3: str
    #: The comment.
    comment: str
