"""
Agent Memory System

Multi-tier cognitive memory for AI agents, providing:
- Working Memory: Session-scoped ephemeral state (Redis/In-memory)
- Episodic Memory: Experiential records of past tasks (PostgreSQL)
- Semantic Memory: Learned facts and knowledge (PostgreSQL + pgvector)
- Procedural Memory: Learned skills and procedures (PostgreSQL)

Usage:
    from app.services.memory import (
        MemoryManager,
        MemorySettings,
        get_memory_settings,
        MemoryType,
        ScopeLevel,
    )

    # Create a manager for a session
    manager = MemoryManager.for_session(
        session_id="sess-123",
        project_id=uuid,
    )

    async with manager:
        # Working memory
        await manager.set_working("key", {"data": "value"})
        value = await manager.get_working("key")

        # Episodic memory
        episode = await manager.record_episode(episode_data)
        similar = await manager.search_episodes("query")

        # Semantic memory
        fact = await manager.store_fact(fact_data)
        facts = await manager.search_facts("query")

        # Procedural memory
        procedure = await manager.record_procedure(procedure_data)
        procedures = await manager.find_procedures("context")
"""

# Configuration
from .config import (
    MemorySettings,
    get_default_settings,
    get_memory_settings,
    reset_memory_settings,
)

# Exceptions
from .exceptions import (
    CheckpointError,
    EmbeddingError,
    MemoryCapacityError,
    MemoryConflictError,
    MemoryConsolidationError,
    MemoryError,
    MemoryExpiredError,
    MemoryNotFoundError,
    MemoryRetrievalError,
    MemoryScopeError,
    MemorySerializationError,
    MemoryStorageError,
)

# Manager
from .manager import MemoryManager

# Types
from .types import (
    ConsolidationStatus,
    ConsolidationType,
    Episode,
    EpisodeCreate,
    Fact,
    FactCreate,
    MemoryItem,
    MemoryStats,
    MemoryStore,
    MemoryType,
    Outcome,
    Procedure,
    ProcedureCreate,
    RetrievalResult,
    ScopeContext,
    ScopeLevel,
    Step,
    TaskState,
    WorkingMemoryItem,
)

# Reflection (lazy import available)
# Import directly: from app.services.memory.reflection import MemoryReflection

__all__ = [
    "CheckpointError",
    "ConsolidationStatus",
    "ConsolidationType",
    "EmbeddingError",
    "Episode",
    "EpisodeCreate",
    "Fact",
    "FactCreate",
    "MemoryCapacityError",
    "MemoryConflictError",
    "MemoryConsolidationError",
    # Exceptions
    "MemoryError",
    "MemoryExpiredError",
    "MemoryItem",
    # Manager
    "MemoryManager",
    "MemoryNotFoundError",
    "MemoryRetrievalError",
    "MemoryScopeError",
    "MemorySerializationError",
    # Configuration
    "MemorySettings",
    "MemoryStats",
    "MemoryStorageError",
    # Types - Abstract
    "MemoryStore",
    # Types - Enums
    "MemoryType",
    "Outcome",
    "Procedure",
    "ProcedureCreate",
    "RetrievalResult",
    # Types - Data Classes
    "ScopeContext",
    "ScopeLevel",
    "Step",
    "TaskState",
    "WorkingMemoryItem",
    "get_default_settings",
    "get_memory_settings",
    "reset_memory_settings",
    # MCP Tools - lazy import to avoid circular dependencies
    # Import directly: from app.services.memory.mcp import MemoryToolService
]
