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

mood: {
        type: DataTypes.ENUM,
      
      

        values: [

"confident",


"calm",


"focused",


"neutral",


"anxious",


"fearful",


"frustrated",


"angry",


"revengeful",


"euphoric",


"tired",


"stressed"

        ],

      },

confidence_level: {
        type: DataTypes.ENUM,
      
      

        values: [

"very_low",


"low",


"medium",


"high",


"very_high"

        ],

      },

discipline_level: {
        type: DataTypes.ENUM,
      
      

        values: [

"very_low",


"low",


"medium",


"high",


"very_high"

        ],

      },

stress_score: {
        type: DataTypes.DECIMAL,
      
      

      },

emotions_notes: {
        type: DataTypes.TEXT,
      
      

      },

recorded_at: {
        type: DataTypes.DATE,
      
      

      },

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

  mood_entries.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.mood_entries.belongsTo(db.trades, {
      as: 'trade',
      foreignKey: {
        name: 'tradeId',
      },
      constraints: false,
    });




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

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



  return mood_entries;
};


