const Sequelize = require('sequelize');
var db = require("../database/db.js");
const Cargo = require('./cargo.js');
const Area = db.sequelize.define('AREA', {

    //INFORMACIÓN PERSONAL
    ID_AREA: {
        primaryKey: true,
        type: Sequelize.BIGINT,
        allowNull: false,
        autoIncrement: true
    },

    CODIGO: {
        type: Sequelize.INTEGER,
        allowNull: false,
    },

    DESCRIPCION: {
        type: Sequelize.STRING,
        allowNull: false,
    },
    ESTADO: {
        type: Sequelize.INTEGER,
        allowNull: false,
    },

   
},
    {
        timestamps: false,
        id: false
    })



     Area.hasMany(Cargo, { foreignKey: 'ID_AREA', sourceKey: 'ID_AREA' });
     Cargo.belongsTo(Area, { foreignKey: 'ID_AREA', sourceKey: 'ID_AREA'});
   

module.exports = Area;