"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultAlertDefinition = void 0;
const tslib_1 = require("tslib");
const ObjectFactory_1 = tslib_1.__importDefault(require("../../../Utilities/ObjectFactory"));
const getAlertType_1 = require("./getAlertType");
/**
 * This logic should be moved into Object factory once we have types on alert definitions
 * @param type AlertType
 */
const getDefaultAlertDefinition = (alertDefinition, type) => {
    const newAlert = {
        ...ObjectFactory_1.default.CreateEmptyAlertDefinition(),
        Uuid: alertDefinition.Uuid,
    };
    // can only be all
    if (type === getAlertType_1.AlertType.Observable ||
        type === getAlertType_1.AlertType.Aggregation ||
        type === getAlertType_1.AlertType.RowChange) {
        newAlert.Scope = {
            All: true,
        };
    }
    if (type === getAlertType_1.AlertType.RowChange) {
        newAlert.Rule = {
            ObservableExpression: 'ROW_ADDED()',
        };
    }
    if (type === getAlertType_1.AlertType.Validation) {
        newAlert.AlertProperties = {
            PreventEdit: true,
        };
    }
    return newAlert;
};
exports.getDefaultAlertDefinition = getDefaultAlertDefinition;
