module.exports = (sequelize, DataTypes) => {
  const user = sequelize.define(
    "user",
    {
      id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        autoIncrement: true,
      },
      email: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: true,
      },
      name: {
        type: DataTypes.STRING,
        allowNull: false,
      },
      status: {
        type: DataTypes.INTEGER, // 0: inactive, 1: active
        allowNull: false,
        defaultValue: 1,
      },
    },
    {
      timestamps: true,
      freezeTableName: true,
      tableName: "user",
      createdAt: "created_at",
      updatedAt: "updated_at",
    }
  );
  return user;
};
