"""
Engram — Neural Memory Format for AI Systems

Python SDK for reading, writing, and manipulating .engram files.

Example:
    >>> from engram import MemoryTree
    >>> tree = MemoryTree.from_file("memories.engram")
    >>> print(f"Loaded {tree.size()} memories")
    >>> tree.add("This is a new memory", tags=["example"])
    >>> tree.save("memories.engram")
"""

from .types import (
    # Enums
    ContentType,
    DecayTier,
    EntityType,
    LinkCreator,
    LinkType,
    Modality,
    QualitySource,
    # Content
    ExternalRef,
    NodeContent,
    # Node components
    TemporalInfo,
    QualityInfo,
    NodeMetadata,
    # Main types
    MemoryNode,
    Entity,
    EntityMention,
    EntityRelationship,
    MemoryLink,
    # File structure
    SecurityConfig,
    FileMetadata,
    SchemaConfig,
    FileStats,
    EngramHeader,
    EngramFile,
)

from .io import (
    read_engram,
    write_engram,
    load,
    save,
    ensure_engram_extension,
)

from .core import (
    MemoryTree,
    generate_id,
)

__version__ = "1.0.0"

# Optional LangChain integration
def get_langchain_memory():
    """Import EngramMemory (requires langchain extra)."""
    from .langchain import EngramMemory
    return EngramMemory

__all__ = [
    # Version
    "__version__",
    # Enums
    "ContentType",
    "DecayTier",
    "EntityType",
    "LinkCreator",
    "LinkType",
    "Modality",
    "QualitySource",
    # Content
    "ExternalRef",
    "NodeContent",
    # Node components
    "TemporalInfo",
    "QualityInfo",
    "NodeMetadata",
    # Main types
    "MemoryNode",
    "Entity",
    "EntityMention",
    "EntityRelationship",
    "MemoryLink",
    # File structure
    "SecurityConfig",
    "FileMetadata",
    "SchemaConfig",
    "FileStats",
    "EngramHeader",
    "EngramFile",
    # I/O
    "read_engram",
    "write_engram",
    "load",
    "save",
    "ensure_engram_extension",
    # Core
    "MemoryTree",
    "generate_id",
]
