/**
 * Role.js
 *
 * @description :: A model definition represents a database table/collection.
 * @docs        :: https://sailsjs.com/docs/concepts/models-and-orm/models
 */


module.exports = {
    tableName: 'prof_note', //DEVOIR

    attributes: {
        codeEnseignant: {
            type: 'string',
            columnName: 'codeEnseignant',
            //allowNull: true,
            required: true,
        },
        codeMatiere: {
            type: 'string',
            columnName: 'code_matiere',
            required: true,

        },
        codeEcole: {
            type: 'string',
            columnName: 'code_ecole',
            required: true,

        },

        codeClasse: {
            type: 'string',
            columnName: 'code_classe',
            required: true,

        },
        dateEvaluation: {
            type: 'string',
            //type: 'string',
            columnName: 'date_evaluation',
            // columnType:'datetime',
            //required: true,

        },
        typeNote: {
            type: 'string',
            columnName: 'type_note',
            required: true,
        },

        libDevoir: {
            type: 'string',
            columnName: 'lib_devoir',
            allowNull: true
        },
        trimSem: {
            type: 'string',
            columnName: 'trim_sem',
            required: true,
        },

        ordre: {
            type: 'string',
            columnName: 'ordre',
            allowNull: true,
            //columnType: 'bigint'
        },
        codMoy: {
            type: 'string',
            columnName: 'COD_MOY',
            allowNull: true,
            //columnType: 'bigint'
        },
        coef: {
            type: 'string',
            columnName: 'coef',
            required: true,
            //columnType: 'bigint'
        },

        anneeScolaire: {
            type: 'string',
            columnName: 'annee_scolaire',
            required: true,
        },

        codeNatureDevoir: {
            type: 'string',
            columnName: 'code_nature_devoir',
            required: true,
        },
        dateEnregistrement: {
            type: 'string',
            columnName: 'date_enregistrement',
            allowNull: true

        },
        heureEnregistrement: {
            type: 'string',
            columnName: 'heure_enregistrement',
            allowNull: true

        },
        etatNote: { // voir si c'est envoyé en local ou non / Ou sera utilisé pour voir si nc'est mise a disposition des parents
            type: 'string',
            columnName: 'etat_note',
            defaultsTo: 'NON',
        },
        validation: { // Voir si note valider pour exporter ou pas
            type: 'string',
            columnName: 'validation',
            defaultsTo: 'NON',
        },
        validatedBy: {
            type: 'string' ,// ID ou nom de l'utilisateur
            columnName: 'validate_by',
            allowNull: true


        },
        validatedAt: {
            type: 'number', // timestamp
            columnName: 'validate_at',
            allowNull: true


        },
        validationComment: {
            type: 'string',
            columnName: 'validation_comment',
            allowNull: true

            
        },
        typeDev: {
            type: 'string',
            columnName: 'type_dev',
            allowNull: true
        },
        barem: {
            type: 'string',
            columnName: 'baren',
            defaultsTo: '20',
        },
        idMatTrimNatureClasse: {
            type: 'string',
            columnName: 'id_mat_trim_nature_classe',
            allowNull: true
        },
        idClasseMatTrim: {
            type: 'string',
            columnName: 'id_classe_mat_trim',
            allowNull: true
        },

    },

};

