const config = require('../../config');
const providers = config.providers;
const crypto = require('crypto');
const bcrypt = require('bcrypt');
const moment = require('moment');

module.exports = function(sequelize, DataTypes) {
  const withholding_tax_tables = sequelize.define(
    'withholding_tax_tables',
    {
      id: {
        type: DataTypes.UUID,
        defaultValue: DataTypes.UUIDV4,
        primaryKey: true,
      },

periodType: {
        type: DataTypes.ENUM,
      
      

        values: [

"SEMI_MONTHLY",


"MONTHLY",


"ANNUAL"

        ],

      },

salaryFrom: {
        type: DataTypes.DECIMAL,
      
      

      },

salaryTo: {
        type: DataTypes.DECIMAL,
      
      

      },

baseTax: {
        type: DataTypes.DECIMAL,
      
      

      },

excessRate: {
        type: DataTypes.DECIMAL,
      
      

      },

excessOver: {
        type: DataTypes.DECIMAL,
      
      

      },

effectiveYear: {
        type: DataTypes.INTEGER,
      
      

      },

      importHash: {
        type: DataTypes.STRING(255),
        allowNull: true,
        unique: true,
      },
    },
    {
      timestamps: true,
      paranoid: true,
      freezeTableName: true,
    },
  );

  withholding_tax_tables.associate = (db) => {


/// loop through entities and it's fields, and if ref === current e[name] and create relation has many on parent entity













































//end loop






    db.withholding_tax_tables.belongsTo(db.users, {
      as: 'createdBy',
    });

    db.withholding_tax_tables.belongsTo(db.users, {
      as: 'updatedBy',
    });
  };



  return withholding_tax_tables;
};


