'use strict';
module.exports = (sequelize, DataTypes) => {
  const member = sequelize.define('member', {
    email: {
      type: DataTypes.STRING,
      allowNull: false,
      unique: {
        msg: 'This email is already taken.'
      },
      validate: {
        isEmail: {
          msg: 'Email address must be valid.'
        }
      }
    },
    username: {
      type: DataTypes.STRING,
      allowNull: false,
      unique: {
        msg: 'This username is already taken.'
      },
      validate: {
        len: {
          args: [5, 50],
          msg: 'Your username may be 5 to 50 characters only.'
        }
      }
    },
    password: {
      type: DataTypes.STRING,
      allowNull: false,
      validate: {
        len: {
          args: [5, 72],
          msg: 'Your password may be 5 to 72 characters only.'
        }
      }
    },
    firstname: {
      type: DataTypes.STRING,
      allowNull: false,
      validate: {
        len: {
          args: [5, 50],
          msg: 'Your first name may be 5 to 50 characters only.'
        }
      }
    },
    lastname: {
      type: DataTypes.STRING,
      allowNull: false,
      validate: {
        len: {
          args: [5, 50],
          msg: 'Your last name may be 5 to 50 characters only.'
        }
      }
    },
  }, {});
  member.associate = function (models) {
    // associations
  };
  return member;
};