const { DataTypes } = require("sequelize");
const { db } = require("../utils");

const User = db.define("users", {
  id: {
    type: DataTypes.INTEGER,
    autoIncrement: true,
    primaryKey: true,
  },
  userName: {
    type: DataTypes.STRING,
    allowNull: false,
  },
  firstName: {
    type: DataTypes.STRING,
    allowNull: true,
  },
  lastName: {
    type: DataTypes.STRING,
    allowNull: true,
  },
  userType: {
    type: DataTypes.STRING,
    allowNull: false,
    defaultValue: "user",
  },
  email: {
    type: DataTypes.STRING,
    allowNull: true,
  },
  mobileNo: {
    type: DataTypes.STRING,
    allowNull: true,
    defaultValue: "",
  },
  countryCode: {
    type: DataTypes.STRING,
    allowNull: true,
  },
  image: {
    type: DataTypes.TEXT,
    allowNull: true,
  },
  coverImage: {
    type: DataTypes.TEXT,
    allowNull: true,
  },
  password: {
    type: DataTypes.TEXT,
    allowNull: true,
  },
  verificationCode: {
    type: DataTypes.TEXT,
    allowNull: true,
  },
  notificationToken: {
    type: DataTypes.TEXT,
    allowNull: true,
  },
  isSocialSignup: {
    type: DataTypes.BOOLEAN,
    defaultValue: false,
  },
  socialType: {
    type: DataTypes.STRING,
    allowNull: true,
  },
  isBlocked: {
    type: DataTypes.BOOLEAN,
    defaultValue: false,
  },
  planActivationDate: {
    type: DataTypes.DATE,
    allowNull: true,
  },
});

module.exports = User;
