"""Composition-root errors shared across runtime factories.

These are raised at composition time (``build_*`` factory entry) and
NOT during the running flight. Components own their per-runtime error
families; this module owns the cross-component selection errors.
"""

from __future__ import annotations


class RuntimeNotAvailableError(RuntimeError):
    """Raised when ``build_*`` is asked for a runtime whose compile-time
    ``BUILD_*`` flag is OFF.

    Used by:
    - ``runtime_root.storage_factory.build_descriptor_index`` (AZ-303 / E-C6,
      ``BUILD_FAISS_INDEX`` gate)
    - ``runtime_root.inference_factory.build_inference_runtime`` (AZ-297 / E-C7,
      ``BUILD_TENSORRT_RUNTIME`` / ``BUILD_ONNX_TRT_EP_RUNTIME`` /
      ``BUILD_PYTORCH_FP16_RUNTIME`` gates)

    The message MUST name the requested runtime label so the operator can
    correlate against ``.env``'s ``BUILD_*`` matrix without guessing.
    """


class StrategyNotAvailableError(RuntimeError):
    """Raised when ``build_vio_strategy`` is asked for a VIO strategy whose
    compile-time ``BUILD_*`` flag is OFF (AZ-331).

    Distinct from :class:`RuntimeNotAvailableError` because the C1
    contract names this error type explicitly (AC-5). The message
    MUST name both the requested strategy label and the missing
    ``BUILD_*`` flag so the operator can correlate against the
    binary's compile matrix.
    """
