const Sequelize = require('sequelize');
var db = require("../database/db.js");
const Canton = require('./canton.js');

const Provincia = db.sequelize.define('PROVINCIA', {

  
    ID_PROVINCIA: {
        primaryKey: true,
        type: Sequelize.BIGINT,
        allowNull: false,
        autoIncrement: true
    },

    NOMBRE: {
        type: Sequelize.STRING,
        allowNull: false,
    },

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



   
    Provincia.hasMany(Canton, { foreignKey: 'ID_PROVINCIA', sourceKey: 'ID_PROVINCIA'   });
    Canton.belongsTo(Provincia, { foreignKey: 'ID_PROVINCIA', sourceKey: 'ID_PROVINCIA' , as:'PROVINCIA' });
   


module.exports = Provincia;