// (C) 2022-2025 GoodData Corporation
import { ARITHMETIC_OPERATORS } from "@gooddata/sdk-ui-ext";
/**
 * @internal
 */
export function isChangeOperator(alert) {
    if (alert?.condition?.type === "relative") {
        return alert.condition.measure.operator === ARITHMETIC_OPERATORS.ARITHMETIC_OPERATOR_CHANGE;
    }
    return false;
}
/**
 * @internal
 */
export function isDifferenceOperator(alert) {
    if (alert?.condition?.type === "relative") {
        return alert.condition.measure.operator === ARITHMETIC_OPERATORS.ARITHMETIC_OPERATOR_DIFFERENCE;
    }
    return false;
}
/**
 * @internal
 */
export function isAnomalyDetection(alert) {
    return alert?.condition?.type === "anomalyDetection";
}
/**
 * @internal
 */
export function isChangeOrDifferenceOperator(alert) {
    return isChangeOperator(alert) || isDifferenceOperator(alert);
}
/**
 * @internal
 */
export function isAlertValueDefined(alert) {
    if (alert?.condition?.type === "relative") {
        return typeof alert.condition.threshold !== "undefined";
    }
    if (alert?.condition?.type === "comparison") {
        return typeof alert.condition.right !== "undefined";
    }
    return (typeof alert?.condition?.sensitivity !== "undefined" &&
        typeof alert?.condition?.granularity !== "undefined");
}
/**
 * @internal
 */
export function isAlertRecipientsValid(alert) {
    return !!alert?.recipients?.length;
}
//# sourceMappingURL=guards.js.map