# -*- coding: UTF-8 -*

"""Modèles base de données ScoDoc
"""

import sqlalchemy

CODE_STR_LEN = 16  # chaine pour les codes
SHORT_STR_LEN = 32  # courtes chaine, eg acronymes
APO_CODE_STR_LEN = 512  # nb de car max d'un code Apogée (il peut y en avoir plusieurs)
GROUPNAME_STR_LEN = 64
USERNAME_STR_LEN = 64

convention = {
    "ix": "ix_%(column_0_label)s",
    "uq": "uq_%(table_name)s_%(column_0_name)s",
    "ck": "ck_%(table_name)s_%(constraint_name)s",
    "fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
    "pk": "pk_%(table_name)s",
}

metadata_obj = sqlalchemy.MetaData(naming_convention=convention)

from app.models.raw_sql_init import create_database_functions

from app.models.absences import Absence, AbsenceNotification, BilletAbsence
from app.models.departements import Departement
from app.models.etudiants import (
    Identite,
    Adresse,
    Admission,
    ItemSuivi,
    ItemSuiviTag,
    itemsuivi_tags_assoc,
    EtudAnnotation,
)
from app.models.events import Scolog, ScolarNews
from app.models.formations import Formation, Matiere
from app.models.modules import Module, ModuleUECoef, NotesTag, notes_modules_tags
from app.models.ues import DispenseUE, UniteEns
from app.models.formsemestre import (
    FormSemestre,
    FormSemestreEtape,
    FormationModalite,
    FormSemestreUECoef,
    FormSemestreUEComputationExpr,
    FormSemestreCustomMenu,
    FormSemestreInscription,
    notes_formsemestre_responsables,
    NotesSemSet,
    notes_semset_formsemestre,
)
from app.models.moduleimpls import (
    ModuleImpl,
    notes_modules_enseignants,
    ModuleImplInscription,
)
from app.models.evaluations import (
    Evaluation,
    EvaluationUEPoids,
)
from app.models.groups import Partition, GroupDescr, group_membership
from app.models.notes import (
    BulAppreciations,
    NotesNotes,
    NotesNotesLog,
)
from app.models.validations import (
    ScolarEvent,
    ScolarFormSemestreValidation,
    ScolarAutorisationInscription,
)
from app.models.preferences import ScoPreference

from app.models.but_refcomp import (
    ApcAppCritique,
    ApcCompetence,
    ApcNiveau,
    ApcParcours,
    ApcReferentielCompetences,
    ApcSituationPro,
)
from app.models.but_validations import ApcValidationAnnee, ApcValidationRCUE

from app.models.config import ScoDocSiteConfig
