1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! Date-based ruleset resolution for all registered methodologies.
//!
//! Each `resolve_*` function answers: "given a product category and a date,
//! which ruleset version is legally in force?" Multiple versions of the same
//! product category can coexist in the table (sequential or overlapping date
//! ranges); the filter returns the one active on `on_date`.
//!
//! ## Module layout
//!
//! - `resolve` — [`all_rulesets`] + the `resolve_*` lookups.
//! - `status` — the machine-readable [`CalculatorStatus`] map.
//!
//! ## Caller pattern
//!
//! ```rust,ignore
//! use dpp_calc::clock::AssessmentClock;
//! use dpp_calc::{repairability, ruleset_registry};
//!
//! // The date the law attached to this product — from its own record, never today.
//! let clock = AssessmentClock::placed_on(product.placed_on_market_date);
//!
//! match ruleset_registry::resolve_repairability("smartphone-tablet", clock.law_in_force_on) {
//! Assessability::Assessed(ruleset) => {
//! let result = repairability::calculate(&inputs, ruleset, clock)?;
//! }
//! // Each of these is a different thing to tell an operator, and none of
//! // them is "non-compliant".
//! Assessability::NotYetInForce { applies_from, .. } => { /* applies from … */ }
//! Assessability::Undetermined { empowerment, .. } => { /* awaiting … */ }
//! Assessability::Expired { superseded_by, .. } => { /* see successor … */ }
//! Assessability::OutOfScope => { /* category not covered */ }
//! }
//! ```
//!
//! ## Adding a new version
//!
//! When `SimplifiedRepairabilityHeuristicV2` is introduced (e.g. from 2027-01-01):
//! 1. Close the current one: `Effectivity::closed(from, 2026-12-31)`.
//! 2. Add `SimplifiedRepairabilityHeuristicV2` with `from = 2027-01-01`.
//! 3. Add a second `"smartphone-tablet"` row to the table — no caller changes.
//!
//! ## Sunset policy
//!
//! Old rulesets stay in the table indefinitely. Their `Effectivity::InForce.until`
//! gates them from new calculations. Receipts reference rulesets by ID+version,
//! so removing a ruleset would make old receipts unverifiable. Never delete rows.
pub use ;
pub use ;