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