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

height_cm: {
        type: DataTypes.DECIMAL,
      
      

      },

height_ft: {
        type: DataTypes.DECIMAL,
      
      

      },

height_in: {
        type: DataTypes.DECIMAL,
      
      

      },

weight_kg: {
        type: DataTypes.DECIMAL,
      
      

      },

weight_lb: {
        type: DataTypes.DECIMAL,
      
      

      },

wrist_circumference_cm: {
        type: DataTypes.DECIMAL,
      
      

      },

dominant_hand: {
        type: DataTypes.ENUM,
      
      

        values: [

"left",


"right",


"ambidextrous"

        ],

      },

fitzpatrick_skin_type: {
        type: DataTypes.ENUM,
      
      

        values: [

"1",


"2",


"3",


"4",


"5",


"6"

        ],

      },

blood_type: {
        type: DataTypes.ENUM,
      
      

        values: [

"a_plus",


"a_minus",


"b_plus",


"b_minus",


"ab_plus",


"ab_minus",


"o_plus",


"o_minus",


"unknown"

        ],

      },

rh_factor: {
        type: DataTypes.ENUM,
      
      

        values: [

"positive",


"negative",


"unknown"

        ],

      },

body_frame_size: {
        type: DataTypes.ENUM,
      
      

        values: [

"small",


"medium",


"large",


"unknown"

        ],

      },

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

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




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

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



  return user_physical_baselines;
};


