const { DataTypes } = require("sequelize");

module.exports = (sequelize) => {
  const ReleaseNote = sequelize.define(
    "releasenote",
    {
      id: {
        type: DataTypes.INTEGER,
        autoIncrement: true,
        primaryKey: true,
      },
      creation: { type: DataTypes.DATE, allowNull: false },
      modified: { type: DataTypes.DATE, allowNull: false },
      modified_by: { type: DataTypes.INTEGER, allowNull: false },
      owner: { type: DataTypes.INTEGER, allowNull: false },
      enabled: { type: DataTypes.BOOLEAN, allowNull: false },

      version: { type: DataTypes.STRING(10), allowNull: false },
      display_name: { type: DataTypes.STRING(100), allowNull: false },
      description: { type: DataTypes.TEXT, allowNull: true },
      release_date: { type: DataTypes.DATE, allowNull: false },
      release_type: { type: DataTypes.STRING(50), allowNull: false },
      new_features: { type: DataTypes.TEXT, allowNull: true },
      bug_fixes: { type: DataTypes.TEXT, allowNull: true },
      improvements: { type: DataTypes.TEXT, allowNull: true },
      breaking_changes: { type: DataTypes.TEXT, allowNull: true },
    },
    {
      tableName: "releasenotes",
      freezeTableName: true,
    }
  );

  /**
   * Associates the ReleaseNote model with other models.
   * @param {object} models - The models to associate with.
   */
  ReleaseNote.associate = (models) => {};

  return ReleaseNote;
};
