# ============================================================
# src/accountable_record/stage_050_catalog/base/constants.py
# ============================================================
"""Catalog-stage constants and diagnostic codes (Layer 0).

WHY:
    Stage 050 builds a normalized catalog over the elements validated by stage
    040, and reconciles that built catalog against the repository's declared
    element catalog (data/catalog/elements.json). This module is the stage's
    Layer 0 vocabulary: the AR.CA.* diagnostic codes plus the structural
    constants naming the declared catalog location, its schema tag, and the
    observed catalog-entry fields. Mirrors the constants modules of earlier
    stages.

OBS (consume, do not re-discover):
    Stage 050 consumes state.elements (the s040 ElementRegistry) as its
    source of truth for WHICH elements exist. It does not re-walk
    data/elements/ to discover elements. It may read an element's
    already-validated element.toml to enrich a catalog entry with descriptive
    fields, because s040 already proved that file present and parseable; that
    is enrichment of a validated set, not re-discovery.

OBS (boundary):
    s050 builds and reconciles a catalog. It does NOT write generated export
    files, reconcile lock digests, or own data/export/elements/. export.py
    prepares an in-memory serializable representation only.

OBS (data-driven):
    No hardcoded element names, category list, or element count. The declared
    category set and declared catalog entries are read from data files at
    runtime; discovered entries come from state.elements.

REQ:
    - No internal dependencies beyond the shared Layer 0 diagnostics module.
    - Concern is Concern.CATALOG ("CA"), already defined in the shared
      diagnostics enum; 050 does not mint new concerns.
"""

STAGE_NAME = "stage_050_catalog"

# The repository's DECLARED element catalog, used by index.py for
# discovered-vs-declared reconciliation. A path, not a hardcoded entry list.
DECLARED_CATALOG_PATH = "data/catalog/elements.json"

# Observed schema tag on the declared catalog and the catalog this stage builds.
CATALOG_SCHEMA_TAG = "ar-element-catalog-1"

# Declared catalog top-level shape (observed): {count, elements[], schema}.
CATALOG_KEY_ELEMENTS = "elements"
CATALOG_KEY_COUNT = "count"
CATALOG_KEY_SCHEMA = "schema"

# Catalog-entry fields observed in data/catalog/elements.json. compact_id is
# the reconciliation key; the rest are descriptive fields enriched from each
# element's already-validated element.toml. element.toml carries these under
# [identity] (compact_id, local_name, label, canonical_uri, persistent_id),
# [classification] (artifact_kind, component_group), and [release]
# (version, status); source is the element.toml path.
ENTRY_KEY_COMPACT_ID = "compact_id"
ENTRY_KEY_COMPONENT_GROUP = "component_group"
ENTRY_KEY_LOCAL_NAME = "local_name"
ENTRY_KEY_LABEL = "label"
ENTRY_KEY_ARTIFACT_KIND = "artifact_kind"
ENTRY_KEY_CANONICAL_URI = "canonical_uri"
ENTRY_KEY_PERSISTENT_ID = "persistent_id"
ENTRY_KEY_VERSION = "version"
ENTRY_KEY_STATUS = "status"
ENTRY_KEY_SOURCE = "source"

# element.toml table/key names the enrichment reads (already validated by s040).
ELEMENT_FILENAME = "element.toml"
TABLE_IDENTITY = "identity"
TABLE_CLASSIFICATION = "classification"
TABLE_RELEASE = "release"
