'use strict';

module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.addColumn(
      'number_format_master',
      'format_prefix',
      {
        type: Sequelize.STRING(20),
        allowNull: true,
        comment: 'Short prefix in number e.g. PO, MR, GRN (used with company code)'
      }
    );
    await queryInterface.addColumn(
      'number_format_master',
      'include_fiscal_year',
      {
        type: Sequelize.BOOLEAN,
        allowNull: false,
        defaultValue: true,
        comment: 'Include fiscal year in generated number'
      }
    );
    await queryInterface.addColumn(
      'number_format_master',
      'fiscal_year_format',
      {
        type: Sequelize.STRING(10),
        allowNull: true,
        comment: 'YYYY-YY (e.g. 2025-26) or YYYY'
      }
    );
  },

  async down(queryInterface) {
    await queryInterface.removeColumn('number_format_master', 'fiscal_year_format');
    await queryInterface.removeColumn('number_format_master', 'include_fiscal_year');
    await queryInterface.removeColumn('number_format_master', 'format_prefix');
  }
};
