/**
 * Deterministic GRU policy (must match PolicyMath.sol / HYBX_OMNL_POLICY_SPEC).
 */
const M0_NUM = 12n;
const M0_DEN = 10n;
const M1_CAP = 5n;

export function minReservesForM0(s0: bigint): bigint {
  if (s0 === 0n) return 0n;
  return (s0 * M0_NUM + M0_DEN - 1n) / M0_DEN;
}

export function maxM1ForM0(s0: bigint): bigint {
  return s0 * M1_CAP;
}

export function isCompliant(s0: bigint, s1: bigint, r: bigint): boolean {
  return r >= minReservesForM0(s0) && s1 <= maxM1ForM0(s0);
}
