nx_hardship_nav.nx source
↩ module page · 55 lines · 3839 B
1// nx_hardship_nav.nx -- the HARDSHIP / RELIEF module (operator's explicit emphasis; where sit_priority=0 routes).
2// Computable, verifiable eligibility + impact math for the relief paths: bankruptcy means-test (11 USC 707(b)),
3// PSLF/IDR loan forgiveness tracking, and forbearance interest-accrual impact. Integer-exact (cents/bps/months).
4// DOCTRINE: these are REGULATED. This is decision-SUPPORT + eligibility screening + draft-prep ONLY -- a licensed
5// attorney / advisor signs. hn_requires_professional() = 1 always for these paths. license_tier: ORIGINAL
6import "nx_syscalls.nx"
7const PSLF_MAGIC_10000: i64 = 10000
8const PSLF_MAGIC_120000: i64 = 120000
9
10const PSLF_REQUIRED_PAYMENTS: i64 = 120 // 120 qualifying payments (34 CFR 685.219 -- PSLF)
11// means-test verdicts:
12const MT_CH7_OK: i64 = 0 // below median OR low disposable -> Chapter 7 available
13const MT_NEEDS_ANALYSIS: i64 = 1 // between thresholds -> depends on unsecured debt (further analysis)
14const MT_PRESUMED_ABUSE: i64 = 2 // high disposable -> presumption of abuse -> steered to Chapter 13
15
16// --- Bankruptcy means test (11 USC 707(b)) ---
17func hn_annualize(monthly_cmi: i64) -> i64 { return monthly_cmi * 12 }
18// step 1: annualized current monthly income at/below the state median for household size? below -> Ch.7 presumption OK.
19func hn_below_median(annual_cmi: i64, state_median: i64) -> i64 { if annual_cmi <= state_median { return 1 } return 0 }
20// step 2 (only if above median): monthly disposable = CMI - allowed expenses (IRS/local standards).
21func hn_disposable_monthly(cmi_monthly: i64, allowed_expenses_monthly: i64) -> i64 { return cmi_monthly - allowed_expenses_monthly }
22// step 3: 60-month disposable vs the statutory dollar thresholds (PARAMS -- they adjust every ~3 years).
23func hn_presumption(disposable_monthly: i64, low_60mo: i64, high_60mo: i64) -> i64 {
24 var d: i64 = disposable_monthly; if d < 0 { d = 0 }
25 let sixty: i64 = d * 60
26 if sixty < low_60mo { return MT_CH7_OK }
27 if sixty >= high_60mo { return MT_PRESUMED_ABUSE }
28 return MT_NEEDS_ANALYSIS
29}
30// full Chapter-7 screen: below median -> OK; else run the disposable-income test.
31func hn_ch7_screen(annual_cmi: i64, state_median: i64, cmi_monthly: i64, allowed_monthly: i64, low_60mo: i64, high_60mo: i64) -> i64 {
32 if hn_below_median(annual_cmi, state_median) == 1 { return MT_CH7_OK }
33 return hn_presumption(hn_disposable_monthly(cmi_monthly, allowed_monthly), low_60mo, high_60mo)
34}
35
36// --- PSLF / IDR loan forgiveness tracking ---
37func hn_pslf_remaining(qualifying: i64) -> i64 { let r: i64 = PSLF_REQUIRED_PAYMENTS - qualifying; if r < 0 { return 0 } return r }
38func hn_pslf_complete(qualifying: i64) -> i64 { if qualifying >= PSLF_REQUIRED_PAYMENTS { return 1 } return 0 }
39func hn_pslf_progress_bps(qualifying: i64) -> i64 {
40 var q: i64 = qualifying; if q > PSLF_REQUIRED_PAYMENTS { q = PSLF_REQUIRED_PAYMENTS }
41 return q * PSLF_MAGIC_10000 / PSLF_REQUIRED_PAYMENTS
42}
43// IDR forgiveness after plan_months qualifying payments (240 = 20yr, 300 = 25yr) -- plan_months is a param.
44func hn_idr_remaining(qualifying: i64, plan_months: i64) -> i64 { let r: i64 = plan_months - qualifying; if r < 0 { return 0 } return r }
45
46// --- Forbearance interest-accrual impact ---
47// accrued interest over `months` (simple, on principal) = the COST of forbearance (capitalized at the end).
48func hn_forbearance_cost(balance: i64, apr_bps: i64, months: i64) -> i64 {
49 let monthly: i64 = balance * apr_bps / PSLF_MAGIC_120000
50 return monthly * months
51}
52func hn_forbearance_balance(balance: i64, apr_bps: i64, months: i64) -> i64 { return balance + hn_forbearance_cost(balance, apr_bps, months) }
53
54// --- doctrine gate: these paths are REGULATED -> a licensed professional signs (UI must surface this). ---
55func hn_requires_professional() -> i64 { return 1 }