"use strict";

module.exports = {
  up: async (queryInterface, Sequelize) => {
    await queryInterface.addColumn("Merchants", "isLiveMode", {
      type: Sequelize.BOOLEAN,
      defaultValue: false,
      allowNull: false,
      comment: "Indicates if merchant has been approved for live payment processing and live API keys",
    });

    await queryInterface.addColumn("Merchants", "kybStatus", {
      type: Sequelize.ENUM("unsubmitted", "pending", "in_review", "approved", "rejected"),
      defaultValue: "unsubmitted",
      allowNull: false,
    });

    await queryInterface.addColumn("Merchants", "livePublicKey", {
      type: Sequelize.STRING,
      allowNull: true,
      unique: true,
      comment: "Live public key (pk_live_...) issued upon KYB approval",
    });

    await queryInterface.addColumn("Merchants", "livePrivateKey", {
      type: Sequelize.STRING,
      allowNull: true,
      comment: "Live private key (sk_live_...) issued upon KYB approval",
    });
  },

  down: async (queryInterface) => {
    await queryInterface.removeColumn("Merchants", "isLiveMode");
    await queryInterface.removeColumn("Merchants", "kybStatus");
    await queryInterface.removeColumn("Merchants", "livePublicKey");
    await queryInterface.removeColumn("Merchants", "livePrivateKey");
  },
};
