"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAvailablePredicateDefinitions = void 0;
const getAvailablePredicateDefinitions = (api, scope, alertType) => {
    let predicateDefs = [];
    if (alertType === 'DataChange' || alertType === 'Validation') {
        predicateDefs = api.alertApi.internalApi
            .getAlertPredicateDefsForScope(scope)
            .filter((predicateDef) => !['AddedRow', 'RemovedRow'].includes(predicateDef.id));
        predicateDefs = [...predicateDefs].sort((a, b) => a.id === 'AnyChange' ? -1 : b.id === 'AnyChange' ? 1 : 0);
    }
    else if (alertType === 'RowChange') {
        predicateDefs = api.alertApi.internalApi
            .getAlertPredicateDefsForScope(scope)
            .filter((predicateDef) => ['AddedRow', 'RemovedRow'].includes(predicateDef.id));
    }
    return predicateDefs;
};
exports.getAvailablePredicateDefinitions = getAvailablePredicateDefinitions;
