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 team_member_skills = sequelize.define(
    'team_member_skills',
    {
      id: {
        type: DataTypes.UUID,
        defaultValue: DataTypes.UUIDV4,
        primaryKey: true,
      },

proficiency: {
        type: DataTypes.ENUM,
      
      

        values: [

"beginner",


"intermediate",


"advanced",


"expert"

        ],

      },

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

  team_member_skills.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.team_member_skills.belongsTo(db.tenants, {
      as: 'tenant',
      foreignKey: {
        name: 'tenantId',
      },
      constraints: false,
    });

    db.team_member_skills.belongsTo(db.team_members, {
      as: 'team_member',
      foreignKey: {
        name: 'team_memberId',
      },
      constraints: false,
    });

    db.team_member_skills.belongsTo(db.skills, {
      as: 'skill',
      foreignKey: {
        name: 'skillId',
      },
      constraints: false,
    });

    db.team_member_skills.belongsTo(db.organizations, {
      as: 'organizations',
      foreignKey: {
        name: 'organizationsId',
      },
      constraints: false,
    });




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

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



  return team_member_skills;
};


