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

main_goal: {
        type: DataTypes.ENUM,
      
      

        values: [

"admission_prep",


"career_switch",


"skill_up",


"exam_result",


"study_abroad",


"personal_interest"

        ],

      },

preferred_session_format: {
        type: DataTypes.ENUM,
      
      

        values: [

"live_video",


"async_review",


"both"

        ],

      },

session_language_preference: {
        type: DataTypes.ENUM,
      
      

        values: [

"bangla",


"english",


"either"

        ],

      },

budget_range: {
        type: DataTypes.ENUM,
      
      

        values: [

"bdt_300_600",


"bdt_600_1200",


"bdt_1200_2500",


"bdt_2500_plus"

        ],

      },

availability_json: {
        type: DataTypes.TEXT,
      
      

      },

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

  learner_profiles.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.learner_profiles.belongsTo(db.users, {
      as: 'user',
      foreignKey: {
        name: 'userId',
      },
      constraints: false,
    });




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

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



  return learner_profiles;
};


