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

log_date: {
        type: DataTypes.DATE,
      
      

      },

flow_intensity: {
        type: DataTypes.ENUM,
      
      

        values: [

"spotting",


"light",


"medium",


"heavy",


"very_heavy"

        ],

      },

cramping: {
        type: DataTypes.INTEGER,
      
      

      },

bloating: {
        type: DataTypes.INTEGER,
      
      

      },

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

      },

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

      },

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

      },

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

      },

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

      },

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

      },

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

      },

notes: {
        type: DataTypes.TEXT,
      
      

      },

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

  menstrual_day_logs.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.menstrual_day_logs.belongsTo(db.menstrual_cycles, {
      as: 'cycle',
      foreignKey: {
        name: 'cycleId',
      },
      constraints: false,
    });




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

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



  return menstrual_day_logs;
};


