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


const Canton = db.sequelize.define('CANTON', {

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

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

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

    

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



    Canton.hasMany(Usuario, { foreignKey: 'ID_CANTON', sourceKey: 'ID_CANTON'  });
    Usuario.belongsTo(Canton, { foreignKey: 'ID_CANTON', sourceKey: 'ID_CANTON' });
   


   
  


module.exports = Canton;