import type { RuleEvalHit } from "./types.js"

export type RecoveryMode = "always" | "never" | "conditional"

export function isRecoveryTransition(hit: RuleEvalHit | null): boolean {
  return hit?.transition === "recovery"
}

export function shouldAllowRecoveryByPolicy(
  hit: RuleEvalHit | null,
  policy: RecoveryMode,
): boolean {
  if (!isRecoveryTransition(hit)) return true
  if (policy === "never") return false
  return true
}
