const Sequelize = require('sequelize');
var db = require("../database/db.js");
const Usuario = require('./usuario.js');
const Historial_Empresa = require('./historial_empresa.js');
const Cargo = db.sequelize.define('CARGO', {

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

    ID_AREA: {
        type: Sequelize.NUMBER,
        allowNull: false,
    },


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

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



   
    Cargo.hasMany(Historial_Empresa, { foreignKey: 'ID_CARGO', sourceKey: 'ID_CARGO' });
    Historial_Empresa.belongsTo(Cargo, { foreignKey: 'ID_CARGO', sourceKey: 'ID_CARGO' });
   


module.exports = Cargo;