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

typical_bedtime: {
        type: DataTypes.TEXT,
      
      

      },

typical_wake_time: {
        type: DataTypes.TEXT,
      
      

      },

alcohol_use: {
        type: DataTypes.ENUM,
      
      

        values: [

"never",


"social",


"weekly",


"daily",


"trying_to_quit"

        ],

      },

tobacco_nicotine_use: {
        type: DataTypes.ENUM,
      
      

        values: [

"never",


"ex_smoker",


"current_smoker",


"vaper",


"chewing_tobacco"

        ],

      },

recreational_substance_use: {
        type: DataTypes.TEXT,
      
      

      },

caffeine_servings_per_day: {
        type: DataTypes.INTEGER,
      
      

      },

typical_stress_level: {
        type: DataTypes.INTEGER,
      
      

      },

occupation_type: {
        type: DataTypes.ENUM,
      
      

        values: [

"sedentary_desk_job",


"active_job",


"manual_labour",


"variable",


"not_working",


"student",


"retired"

        ],

      },

avg_daily_steps_estimate: {
        type: DataTypes.INTEGER,
      
      

      },

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

      },

exercise_types: {
        type: DataTypes.TEXT,
      
      

      },

diet_pattern: {
        type: DataTypes.ENUM,
      
      

        values: [

"omnivore",


"vegetarian",


"vegan",


"pescatarian",


"keto",


"paleo",


"mediterranean",


"halal",


"kosher",


"gluten_free",


"dairy_free",


"low_fodmap",


"other"

        ],

      },

diet_pattern_other: {
        type: DataTypes.TEXT,
      
      

      },

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

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




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

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



  return user_lifestyle_baselines;
};


