"use strict";

module.exports = {
  up: async (queryInterface, Sequelize) => {
    // Add the new JSON field
    await queryInterface.addColumn("SubscriptionPlans", "servicePricingOverrides", {
      type: Sequelize.JSON,
      allowNull: true,
      comment: "Array of service pricing configurations specific to this plan",
    });

    // Remove the old field
    await queryInterface.removeColumn("SubscriptionPlans", "feeDiscountPercent");
  },

  down: async (queryInterface, Sequelize) => {
    // Add back the old field
    await queryInterface.addColumn("SubscriptionPlans", "feeDiscountPercent", {
      type: Sequelize.DECIMAL(5, 2),
      defaultValue: 0.00,
      comment: "Percentage discount on platform fees, e.g., 20.00 = 20% off",
    });

    // Remove the new field
    await queryInterface.removeColumn("SubscriptionPlans", "servicePricingOverrides");
  },
};
