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

module_name: {
        type: DataTypes.TEXT,
      
      

      },

module_type: {
        type: DataTypes.ENUM,
      
      

        values: [

"thinking_method",


"compliance",


"analysis",


"generation",


"research",


"optimization",


"simulation",


"creative"

        ],

      },

module_description: {
        type: DataTypes.TEXT,
      
      

      },

evidence_level: {
        type: DataTypes.ENUM,
      
      

        values: [

"high",


"medium",


"low",


"unknown"

        ],

      },

method_steps: {
        type: DataTypes.TEXT,
      
      

      },

requires_citations: {
        type: DataTypes.BOOLEAN,
      
        allowNull: false,
        defaultValue: false,
      
      

      },

is_active: {
        type: DataTypes.BOOLEAN,
      
        allowNull: false,
        defaultValue: false,
      
      

      },

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

  skill_modules.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.skill_modules.belongsTo(db.users, {
      as: 'createdBy',
    });

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



  return skill_modules;
};


