"""Shared A2A error code mapping for Behave step definitions.

Provides a single source of truth for the mapping between symbolic error
name strings (used in Gherkin feature files) and their corresponding
JSON-RPC 2.0 integer codes (defined in ``cleveragents.a2a.errors``).

All step files that need to translate a symbolic name like ``"NOT_FOUND"``
to its integer code ``-32001`` should import :data:`A2A_CODE_MAP` from
this module rather than defining a local ``_CODE_MAP`` dictionary.

This eliminates the DRY violation identified in code review where the
same mapping was duplicated across 4 step files (6 definitions total).
"""

from __future__ import annotations

from cleveragents.a2a import errors as _a2a_errors

#: Maps symbolic error name strings (as used in Gherkin feature files) to
#: their JSON-RPC 2.0 integer error codes.  Derived directly from the
#: ``cleveragents.a2a.errors`` module constants so that any future change
#: to the integer values is automatically reflected here.
A2A_CODE_MAP: dict[str, int] = {
    "NOT_FOUND": _a2a_errors.NOT_FOUND,
    "AUTH_ERROR": _a2a_errors.AUTH_ERROR,
    "FORBIDDEN": _a2a_errors.FORBIDDEN,
    "INVALID_STATE": _a2a_errors.INVALID_STATE,
    "PLAN_ERROR": _a2a_errors.PLAN_ERROR,
    "CONFIGURATION_ERROR": _a2a_errors.CONFIGURATION_ERROR,
    "VALIDATION_ERROR": _a2a_errors.VALIDATION_ERROR,
    "INTERNAL_ERROR": _a2a_errors.INTERNAL_ERROR,
}

__all__ = ["A2A_CODE_MAP"]
