var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import CaptureSpan from "../../../Utils/Telemetry/CaptureSpan";
export class RenameNotificationRuleTypes1769517677937 {
    constructor() {
        this.name = "RenameNotificationRuleTypes1769517677937";
    }
    async up(queryRunner) {
        /*
         * 1. Update rules with "When on-call policy is executed" and incidentSeverityId (not null)
         *    to "When incident on-call policy is executed"
         */
        await queryRunner.query(`UPDATE "UserNotificationRule"
       SET "ruleType" = 'When incident on-call policy is executed'
       WHERE "ruleType" = 'When on-call policy is executed'
       AND "incidentSeverityId" IS NOT NULL`);
        /*
         * 2. Update rules with "When on-call policy is executed" and alertSeverityId (not null)
         *    to "When alert on-call policy is executed"
         */
        await queryRunner.query(`UPDATE "UserNotificationRule"
       SET "ruleType" = 'When alert on-call policy is executed'
       WHERE "ruleType" = 'When on-call policy is executed'
       AND "alertSeverityId" IS NOT NULL`);
        /*
         * 3. Update rules with "When episode on-call policy is executed"
         *    to "When alert episode on-call policy is executed"
         */
        await queryRunner.query(`UPDATE "UserNotificationRule"
       SET "ruleType" = 'When alert episode on-call policy is executed'
       WHERE "ruleType" = 'When episode on-call policy is executed'`);
    }
    async down(queryRunner) {
        // Revert "When incident on-call policy is executed" back to "When on-call policy is executed"
        await queryRunner.query(`UPDATE "UserNotificationRule"
       SET "ruleType" = 'When on-call policy is executed'
       WHERE "ruleType" = 'When incident on-call policy is executed'`);
        // Revert "When alert on-call policy is executed" back to "When on-call policy is executed"
        await queryRunner.query(`UPDATE "UserNotificationRule"
       SET "ruleType" = 'When on-call policy is executed'
       WHERE "ruleType" = 'When alert on-call policy is executed'`);
        // Revert "When alert episode on-call policy is executed" back to "When episode on-call policy is executed"
        await queryRunner.query(`UPDATE "UserNotificationRule"
       SET "ruleType" = 'When episode on-call policy is executed'
       WHERE "ruleType" = 'When alert episode on-call policy is executed'`);
    }
}
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], RenameNotificationRuleTypes1769517677937.prototype, "up", null);
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], RenameNotificationRuleTypes1769517677937.prototype, "down", null);
//# sourceMappingURL=1769517677937-RenameNotificationRuleTypes.js.map