import type { EscalationRule } from './types';

export const costCapRule: EscalationRule = {
  id: 'cost-cap',
  label: 'תקרת עלות',
  description: 'עלות הרצת הסוכן חרגה מהתקרה',
  async check(ctx) {
    const cap = ctx.definition.maxCostCents;
    if (ctx.currentCostCents <= cap) return null;
    return {
      ruleId: 'cost-cap',
      reason: `עלות ${ctx.currentCostCents} אגורות חרגה מתקרה ${cap}`,
      severity: 'low',
    };
  },
};
