import type { MoneyAmount, PercentOfPay } from './types'; export function percentOfPay(percent: number): PercentOfPay { if (!Number.isFinite(percent) || percent < 0) { throw new Error('Percent of pay must be a non-negative finite number.'); } return { kind: 'percent_of_pay', percent }; } export function fixedAmount(amount: string, currency: string): MoneyAmount { if (amount.trim() === '') { throw new Error('Fixed amount must be a non-empty decimal string.'); } if (currency.trim() === '') { throw new Error('Currency must be a non-empty ISO currency code.'); } return { kind: 'money_amount', amount, currency }; }