"""ACMS (Advanced Context Management System) domain models.

Provides the Context Request Protocol (CRP) data types and the Backend
Abstraction Layer (BAL) protocols used by actors, skills, strategies,
and the Context Assembly Pipeline:

CRP types (from :mod:`~cleveragents.domain.models.acms.crp`):
- ``DetailDepth`` -- Type alias for ``int | str`` detail depth values
- ``DetailLevelError`` -- Raised when a detail level name cannot be resolved
- ``DetailLevelCycleError`` -- Raised when a circular parent chain is detected
- ``DetailLevelMap`` -- Named-level-to-integer resolution with inheritance
- ``ContextRequest`` -- Structured request for context via the CRP
- ``ContextFragment`` -- Atomic unit of retrieved context
- ``FragmentProvenance`` -- Trace-back to source resource and location
- ``ContextBudget`` -- Token budget management with reservation support
- ``AssembledContext`` -- Final budget-respecting context payload

BAL types (from :mod:`~cleveragents.domain.models.acms.backends`):
- ``TextBackend`` / ``TextResult`` -- Full-text search protocol
- ``VectorBackend`` / ``VectorResult`` -- Embedding similarity search
- ``GraphBackend`` / ``GraphResult`` -- SPARQL queries and traversals

Strategy types (from :mod:`~cleveragents.domain.models.acms.strategy`):
- ``ContextStrategy`` -- Pluggable context assembly strategy protocol
- ``StrategyCapabilities`` -- Declares what a strategy can do
- ``BackendSet`` -- Container for available data backends
- ``PlanContext`` -- Lightweight plan hierarchy reference
- ``StrategyConfig`` -- Per-strategy configuration
- ``ContextStrategyResult`` -- Output of a strategy execution
- ``StrategyRegistryEntry`` -- Metadata for a registered strategy

Strategy stubs (from :mod:`~cleveragents.domain.models.acms.strategy_stubs`):
- ``SimpleKeywordStrategy`` -- Basic keyword/regex text search (quality 0.3)
- ``SemanticEmbeddingStrategy`` -- Vector similarity search (quality 0.6)
- ``BreadthDepthNavigatorStrategy`` -- Graph-aware UKO traversal (quality 0.85)
- ``ARCEStrategy`` -- Multi-modal ARCE pipeline (quality 0.95)
- ``TemporalArchaeologyStrategy`` -- Historical pattern discovery (quality 0.5)
- ``PlanDecisionContextStrategy`` -- Parent/ancestor plan context (quality 0.7)

Stub backends (from :mod:`~cleveragents.domain.models.acms.stubs`):
- ``InMemoryTextBackend`` -- Zero-dependency text search stub
- ``InMemoryVectorBackend`` -- Zero-dependency vector search stub
- ``InMemoryGraphBackend`` -- Zero-dependency graph query stub
- ``InMemoryTemporalBackend`` -- In-memory temporal node store stub

Temporal types (from :mod:`~cleveragents.domain.models.acms.temporal`):
- ``TemporalMetadata`` -- Temporal fields on a UKO InformationUnit
- ``TemporalNode`` -- A UKO node with temporal metadata
- ``RevisionChain`` -- Ordered revision chain (oldest-first)
- ``TierQueryResult`` -- Result from a tier-aware temporal query
- ``TierRetentionConfig`` -- Warm/cold tier retention policy
- ``TemporalBackend`` -- Protocol for temporal storage and queries

Tier types (from :mod:`~cleveragents.domain.models.acms.tiers`):
- ``ContextTier`` -- Hot/warm/cold storage tier enumeration
- ``ActorRole`` -- Strategist/executor/reviewer actor roles
- ``TieredFragment`` -- Fragment with tier and access metadata
- ``TierBudget`` -- Per-tier token/decision budget limits
- ``ActorContextView`` -- Per-actor filtered view configuration
- ``TierMetrics`` -- Hit/miss counters for cache monitoring

Scoped view types (from :mod:`~cleveragents.domain.models.acms.scoped_view`):
- ``ResourceScope`` -- Resolved resource/project scope for a plan
- ``ScopeViolationError`` -- Raised on out-of-scope access attempts
- ``ScopedBackendView`` -- Project-scoped backend query filtering
- ``ScopedBackendSet`` -- Bundle of scoped text/vector/graph views
- ``ResourceAliasResolver`` -- Alias-to-resource-ID resolution helper

Analyzer types (from :mod:`~cleveragents.domain.models.acms.analyzers`):
- ``UKOTriple`` -- Immutable subject-predicate-object triple
- ``AnalyzerProtocol`` -- Protocol for domain analyzers
- ``AnalyzerRegistry`` -- Extension-to-analyzer registration

Concrete analyzers:
- ``PythonAnalyzer`` -- AST-based Python source analyzer
- ``MarkdownAnalyzer`` -- Heading/code-block/link Markdown analyzer
- ``PostgreSQLAnalyzer`` -- Regex-based DDL/SQL analyzer
- ``DockerComposeAnalyzer`` -- YAML-based Docker Compose analyzer

Ontology registry
  (from :mod:`~cleveragents.domain.models.acms.ontology_registry`):
- ``DomainDescriptor`` -- Immutable metadata for a UKO domain
- ``OntologyRegistry`` functions -- Domain lookup, Layer 1 listing,
  DetailLevelMap chain building, Turtle validation

Index backend types (from :mod:`~cleveragents.domain.models.acms.index_backends`):
- ``TextIndexBackend`` -- Write-side full-text indexing protocol
- ``VectorIndexBackend`` -- Write-side vector embedding indexing protocol
- ``GraphIndexBackend`` -- Write-side UKO triple storage protocol
- ``IndexedDocument`` -- Record of an indexed document
- ``SearchResult`` -- Result from index backend search

Index stubs (from :mod:`~cleveragents.domain.models.acms.index_stubs`):
- ``InMemoryTextIndexBackend`` -- In-memory text indexing stub
- ``InMemoryVectorIndexBackend`` -- In-memory vector indexing stub
- ``InMemoryGraphIndexBackend`` -- In-memory graph indexing stub

Provenance types (from :mod:`~cleveragents.domain.models.acms.provenance`):
- ``ProvenanceMetadata`` -- Source-tracking metadata for triples
- ``ProvenancedTriple`` -- UKOTriple + provenance composite
- ``IndexResult`` -- Summary of an indexing operation

Based on ``docs/specification.md`` ACMS / CRP sections and ADR-014.
"""

from __future__ import annotations

from cleveragents.domain.models.acms.analyzers import (
    AnalyzerProtocol,
    AnalyzerRegistry,
    UKOTriple,
)
from cleveragents.domain.models.acms.backends import (
    GraphBackend,
    GraphResult,
    TextBackend,
    TextResult,
    VectorBackend,
    VectorResult,
)
from cleveragents.domain.models.acms.crp import (
    AssembledContext,
    ContextBudget,
    ContextFragment,
    ContextRequest,
    DetailDepth,
    DetailLevelCycleError,
    DetailLevelError,
    DetailLevelMap,
    FragmentProvenance,
)
from cleveragents.domain.models.acms.docker_compose_analyzer import (
    DockerComposeAnalyzer,
)
from cleveragents.domain.models.acms.index_backends import (
    GraphIndexBackend,
    IndexedDocument,
    SearchResult,
    TextIndexBackend,
    VectorIndexBackend,
)
from cleveragents.domain.models.acms.index_stubs import (
    InMemoryGraphIndexBackend,
    InMemoryTextIndexBackend,
    InMemoryVectorIndexBackend,
)
from cleveragents.domain.models.acms.markdown_analyzer import MarkdownAnalyzer
from cleveragents.domain.models.acms.ontology_registry import (
    DomainDescriptor,
    TurtleValidationError,
    build_detail_map_chain,
    get_domain,
    get_layer1_domains,
    list_domains,
    validate_turtle,
    validate_turtle_file,
)
from cleveragents.domain.models.acms.postgresql_analyzer import PostgreSQLAnalyzer
from cleveragents.domain.models.acms.provenance import (
    IndexResult,
    ProvenancedTriple,
    ProvenanceMetadata,
)
from cleveragents.domain.models.acms.python_analyzer import PythonAnalyzer
from cleveragents.domain.models.acms.scope_resolution import (
    ResourceAliasResolver,
    resolve_resource_scope,
    validate_project_scope,
    validate_resource_scope,
)
from cleveragents.domain.models.acms.scoped_view import (
    ResourceScope,
    ScopedBackendSet,
    ScopedBackendView,
    ScopeViolationError,
    create_scoped_backend_set,
)
from cleveragents.domain.models.acms.strategy import (
    BackendSet,
    ContextStrategy,
    ContextStrategyResult,
    PlanContext,
    StrategyCapabilities,
    StrategyConfig,
    StrategyRegistryEntry,
)
from cleveragents.domain.models.acms.strategy_stubs import (
    ARCEStrategy,
    BreadthDepthNavigatorStrategy,
    PlanDecisionContextStrategy,
    SemanticEmbeddingStrategy,
    SimpleKeywordStrategy,
    TemporalArchaeologyStrategy,
)
from cleveragents.domain.models.acms.stubs import (
    InMemoryGraphBackend,
    InMemoryTextBackend,
    InMemoryVectorBackend,
)
from cleveragents.domain.models.acms.temporal import (
    RevisionChain,
    TemporalBackend,
    TemporalMetadata,
    TemporalNode,
    TierQueryResult,
    TierRetentionConfig,
)
from cleveragents.domain.models.acms.temporal_stubs import (
    InMemoryTemporalBackend,
)
from cleveragents.domain.models.acms.tiers import (
    ActorContextView,
    ActorRole,
    ContextTier,
    TierBudget,
    TieredFragment,
    TierMetrics,
)

__all__: list[str] = [
    "ARCEStrategy",
    "ActorContextView",
    "ActorRole",
    "AnalyzerProtocol",
    "AnalyzerRegistry",
    "AssembledContext",
    "BackendSet",
    "BreadthDepthNavigatorStrategy",
    "ContextBudget",
    "ContextFragment",
    "ContextRequest",
    "ContextStrategy",
    "ContextStrategyResult",
    "ContextTier",
    "DetailDepth",
    "DetailLevelCycleError",
    "DetailLevelError",
    "DetailLevelMap",
    "DockerComposeAnalyzer",
    "DomainDescriptor",
    "FragmentProvenance",
    "GraphBackend",
    "GraphIndexBackend",
    "GraphResult",
    "InMemoryGraphBackend",
    "InMemoryGraphIndexBackend",
    "InMemoryTemporalBackend",
    "InMemoryTextBackend",
    "InMemoryTextIndexBackend",
    "InMemoryVectorBackend",
    "InMemoryVectorIndexBackend",
    "IndexResult",
    "IndexedDocument",
    "MarkdownAnalyzer",
    "PlanContext",
    "PlanDecisionContextStrategy",
    "PostgreSQLAnalyzer",
    "ProvenanceMetadata",
    "ProvenancedTriple",
    "PythonAnalyzer",
    "ResourceAliasResolver",
    "ResourceScope",
    "RevisionChain",
    "ScopeViolationError",
    "ScopedBackendSet",
    "ScopedBackendView",
    "SearchResult",
    "SemanticEmbeddingStrategy",
    "SimpleKeywordStrategy",
    "StrategyCapabilities",
    "StrategyConfig",
    "StrategyRegistryEntry",
    "TemporalArchaeologyStrategy",
    "TemporalBackend",
    "TemporalMetadata",
    "TemporalNode",
    "TextBackend",
    "TextIndexBackend",
    "TextResult",
    "TierBudget",
    "TierMetrics",
    "TierQueryResult",
    "TierRetentionConfig",
    "TieredFragment",
    "TurtleValidationError",
    "UKOTriple",
    "VectorBackend",
    "VectorIndexBackend",
    "VectorResult",
    "build_detail_map_chain",
    "create_scoped_backend_set",
    "get_domain",
    "get_layer1_domains",
    "list_domains",
    "resolve_resource_scope",
    "validate_project_scope",
    "validate_resource_scope",
    "validate_turtle",
    "validate_turtle_file",
]
