import { QueryInterface } from 'sequelize';

/**
 * Rename CPC admin viewer-list config key from CPC_CDC_* to CPC_CSD_* (display name aligned).
 */
export async function up(queryInterface: QueryInterface): Promise<void> {
  await queryInterface.sequelize.query(`
    UPDATE admin_configurations
    SET
      config_key = 'CPC_CSD_ADMIN_CONFIG',
      display_name = 'CPC-CSD Admin Config',
      description = 'CPC-CSD module visibility settings'
    WHERE config_key = 'CPC_CDC_ADMIN_CONFIG'
  `);
}

export async function down(queryInterface: QueryInterface): Promise<void> {
  await queryInterface.sequelize.query(`
    UPDATE admin_configurations
    SET
      config_key = 'CPC_CDC_ADMIN_CONFIG',
      display_name = 'CPC-CDC Admin Config',
      description = 'CPC-CDC module visibility settings'
    WHERE config_key = 'CPC_CSD_ADMIN_CONFIG'
  `);
}
