import { DQRule } from '../models/dq-rules.model'

/**
 * Whether any rule in the set is HARDFORMULA/SOFTFORMULA - used to gate
 * turning on Handsontable's `formulas` plugin (HyperFormula engine) only
 * when a table actually uses it, rather than for every grid.
 */
export const hasFormulaRules = (dqRules: DQRule[]): boolean =>
  dqRules.some(
    (rule) =>
      rule.RULE_TYPE === 'HARDFORMULA' || rule.RULE_TYPE === 'SOFTFORMULA'
  )
