import { isAdaptableRuleValid } from '../../Components/EntityRulesEditor/Utilities';
export const isValidFlashingCellRules = (flashingCell, api, context) => {
    if (!flashingCell.Rule?.Predicates?.length && !flashingCell.Rule.BooleanExpression) {
        return 'No Rule defined for Flashing Cell';
    }
    const isRuleValid = isAdaptableRuleValid(flashingCell, api, context);
    if (typeof isRuleValid === 'string') {
        return isRuleValid;
    }
    // boolean expressions may also be saved as named queries
    if (context.namedQuery != false) {
        const isValidName = api.namedQueryApi.isValidNamedQuery(context.namedQuery);
        if (!isValidName.valid) {
            return isValidName.message;
        }
    }
    return true;
};
