"""Aggregated obligation scope rules + lookup helpers.""" from __future__ import annotations from typing import Dict, List, Optional from .rules_obligations_cra import CRA_OBLIGATIONS from .rules_obligations_machine_data import DATA_ACT_OBLIGATIONS, MACHINE_OBLIGATIONS from .rules_types import ObligationRule ALL_OBLIGATIONS: List[ObligationRule] = ( CRA_OBLIGATIONS + MACHINE_OBLIGATIONS + DATA_ACT_OBLIGATIONS ) _BY_ID: Dict[str, ObligationRule] = {o.obligation_id: o for o in ALL_OBLIGATIONS} def obligation_rule(obligation_id: str) -> Optional[ObligationRule]: return _BY_ID.get(obligation_id) def obligations_for_regulation(regulation_id: str) -> List[ObligationRule]: return [o for o in ALL_OBLIGATIONS if o.source_regulation == regulation_id]