"""Post-processor registry.

Per scanner-rearchitecture-spec.md Section 4.4: a small fixed library
of reusable primitives that transform a SARIF match into 0..N Findings
inline within result_mapper.py. The registry is closed at scan-start;
rules cannot define ad-hoc Python.
"""

from __future__ import annotations

from .base import (
    PostProcessor,
    PostProcessorRegistry,
    SarifMatch,
    ScanContext,
)
from .comparison_context_analyzer import ComparisonContextAnalyzerPostProcessor
from .cui_classifier import CUIClassifierPostProcessor
from .cve_lookup import CveLookupPostProcessor
from .pan_classifier import PANClassifierPostProcessor
from .phi_classifier import PHIClassifierPostProcessor
from .pii_classifier import PIIClassifierPostProcessor
from .version_range_check import VersionRangeCheckPostProcessor

REGISTRY = PostProcessorRegistry()
REGISTRY.register(CveLookupPostProcessor())
REGISTRY.register(VersionRangeCheckPostProcessor())
REGISTRY.register(ComparisonContextAnalyzerPostProcessor())
# Phase 9 sensitive-data classifiers.
REGISTRY.register(PHIClassifierPostProcessor())
REGISTRY.register(PANClassifierPostProcessor())
REGISTRY.register(PIIClassifierPostProcessor())
REGISTRY.register(CUIClassifierPostProcessor())


def get(name: str) -> PostProcessor:
    return REGISTRY.get(name)


def names() -> list[str]:
    return REGISTRY.names()


def has(name: str) -> bool:
    return name in REGISTRY.names()


__all__ = [
    "PostProcessor",
    "PostProcessorRegistry",
    "SarifMatch",
    "ScanContext",
    "REGISTRY",
    "get",
    "names",
    "has",
]
