module.exports = (sequelize, Sequelize) => {
  const User = sequelize.define("users", {
    id: {
      type: Sequelize.INTEGER,
      primaryKey: true,
      autoIncrement: true
    },
    name: {
      type: Sequelize.STRING
    },
    email: {
      type: Sequelize.STRING,
      allowNull: false,
      validate: {
        isEmail: true
      },
      unique: {
        args: true,
        msg: 'Oops. Looks like email already exist.'
      }
    },
    roll_id: Sequelize.INTEGER,
    email_verified_at: {
      type: Sequelize.STRING,
      defaultValue: null,
      allowNull: true
    },
    email_verified: {
      type: Sequelize.STRING,
      defaultValue: "false"
    },
    email_otp: {
      type: Sequelize.STRING,
      defaultValue: null
    },
    calling_code: Sequelize.STRING,
    mobile: Sequelize.STRING,
    profile_img: Sequelize.TEXT,
    permissions: { type: Sequelize.STRING, defaultValue: 0 }, //permission 0=free,1=Inapp,2=purchesed
    password: Sequelize.STRING,
    remember_token: Sequelize.STRING,
    free_flashcard: Sequelize.STRING,
    free_practque: Sequelize.STRING,
    free_flashccsp: Sequelize.STRING,
    pass_rest_code: Sequelize.STRING,
    avatar_url: Sequelize.TEXT,
    is_first: Sequelize.INTEGER,
    opt_in: Sequelize.INTEGER, //opt_in=1 then opt_in, opt_in=0 then opt_out
    aliasname: {
      type: Sequelize.STRING,
      unique: {
        args: true,
        msg: 'Someone already has that username. Try another?'
      }
    },
    is_temp: Sequelize.INTEGER,
    status: {
      type: Sequelize.INTEGER,
      defaultValue: 0
    },
    address: {
      type: Sequelize.STRING,
      defaultValue: null,
      allowNull: true
    },
    notes: {
      type: Sequelize.STRING,
      defaultValue: null,
      allowNull: true
    },
    company_id: {
      type: Sequelize.INTEGER,
      defaultValue: null,
      allowNull: true
    },
    course_id: {
      type: Sequelize.STRING,
      defaultValue: null,
      allowNull: true
    },
    onboard_cohort: Sequelize.INTEGER,
    schedule_date: Sequelize.STRING,
    welcome_flow: {
      type: Sequelize.INTEGER,
      defaultValue: 0
    },
    allow_access: {
      type: Sequelize.INTEGER,
      defaultValue: 1
    },
    authy_id: {
      type: Sequelize.STRING,
      defaultValue: null,
      allowNull: true
    },
    show_resources: {
      type: Sequelize.INTEGER,
      defaultValue: 1
    },
    two_fact_tab: {
      type: Sequelize.INTEGER,
      defaultValue: 0
    },
    is_live: {
      type: Sequelize.INTEGER,
      defaultValue: 0
    },
    is_selfpaced: {
      type: Sequelize.INTEGER,
      defaultValue: 0
    },
    stripe_customer_id: Sequelize.STRING,
    user_time_zone: Sequelize.STRING,
    is_flashcard_user: {
      type: Sequelize.INTEGER,
      defaultValue: 0
    },
    expire_password: {
      type: Sequelize.INTEGER,
      defaultValue: 0
    },
    onbording_date: Sequelize.TEXT, //onbording completion date
    signup_platform: Sequelize.TEXT,
    overdue_notification: {
      type: Sequelize.INTEGER,
      defaultValue: 1
    },
    mentor_id: Sequelize.INTEGER,
    mentor_notes: Sequelize.TEXT,
    is_mini_masterclass_email_sent: {
      type: Sequelize.INTEGER,
      defaultValue: 1
    }
  });

  return User;
};
