"""In-memory license status, shared by cloud_sync (writes), system/business-day routers (read). Persisted to /license_state.json by services/cloud_sync.py. What the site may USE is decided by core/modules/entitlements.py from the same evaluation; this dict is the status the manager's license page shows. Fields: license_mode "enforced" | "off" (config LICENSE_MODE; "off" only on dev machines) licensed bool - the global license is valid (expiry/grace/lock deferred to the end of an open workday). False = the free tier applies. license_problem None | "unverified" | "expired" | "inactive" | "clock" entitlement_mode "licensed" | "free" | "dev" (from entitlements.compute) locked bool - remote lock enforced (applied at workday close) lock_pending bool - the cloud asked for a lock; waiting for the workday to close expires_at, days_until_expiry, grace_expires_at, grace_days_remaining, grace_over license_token the signed token as received (verified on every evaluation) last_sync, sync_failed, offline_days, time_high_water, latest_version, waiter_domain, site_numeric_id """ license_state: dict = { "license_mode": "enforced", "licensed": False, "license_problem": "unverified", "entitlement_mode": "free", "locked": False, "lock_pending": False, "expires_at": None, "days_until_expiry": None, "grace_expires_at": None, "last_sync": None, "sync_failed": False, "latest_version": None, }