"""
Pipeline check registry — mirrors recoil/tools/engine_checks/ pattern.

Each check module calls register_check() to register its checks.
The runner (recoil_check.py) discovers and runs them.
"""

_checks = []
_section_map = {}
_quick_keys = set()
_fixes = {}


def register_check(key: str, name: str, fn, section: str = None, quick: bool = False):
    """Register a check function. fn(base, discovered) -> {pass:[], fail:[], warn:[]}"""
    _checks.append((key, name, fn))
    if section:
        _section_map.setdefault(section, []).append(key)
    if quick:
        _quick_keys.add(key)


def register_fix(key: str, fn):
    """Register an auto-fix function for a check key."""
    _fixes[key] = fn


def get_all_checks():
    return list(_checks)


def get_section_map():
    return dict(_section_map)


def get_quick_keys():
    return set(_quick_keys)


def get_fixes_for_keys(keys):
    return {k: _fixes[k] for k in keys if k in _fixes}


# Import all check modules to trigger registration
from recoil_checks import api_config
from recoil_checks import execution_store
from recoil_checks import review_server
from recoil_checks import console_frontend
from recoil_checks import pipeline_integrity
from recoil_checks import cross_engine
from recoil_checks import model_roles
from recoil_checks import execution_health
