"""
Memory-LLM: Memory-Enabled Mini Assistant
AI library that remembers user interactions
"""

from .base_llm_client import BaseLLMClient

# New multi-backend support (v1.3.0+)
from .clients import LMStudioClient
from .clients import OllamaClient as OllamaClientNew
from .llm_client import OllamaClient  # Backward compatibility
from .llm_client_factory import LLMClientFactory
from .mem_agent import MemAgent
from .memory_manager import MemoryManager

# Tools (optional)
try:
    from .memory_tools import MemoryTools, ToolExecutor

    __all_tools__ = ["MemoryTools", "ToolExecutor"]
except ImportError:
    __all_tools__ = []

# Pro version imports (optional)
try:
    from .config_from_docs import create_config_from_document
    from .config_manager import get_config
    from .dynamic_prompt import dynamic_prompt_builder
    from .memory_db import SQLMemoryManager

    __all_pro__ = [
        "SQLMemoryManager",
        "get_config",
        "create_config_from_document",
        "dynamic_prompt_builder",
    ]
except ImportError:
    __all_pro__ = []

# Security features (optional, v1.1.0+)
try:
    from .prompt_security import InputSanitizer, PromptInjectionDetector, SecurePromptBuilder

    __all_security__ = ["PromptInjectionDetector", "InputSanitizer", "SecurePromptBuilder"]
except ImportError:
    __all_security__ = []

# Enhanced features (v1.1.0+)
try:
    from .logger import MemLLMLogger, get_logger
    from .retry_handler import SafeExecutor, exponential_backoff_retry

    __all_enhanced__ = ["get_logger", "MemLLMLogger", "exponential_backoff_retry", "SafeExecutor"]
except ImportError:
    __all_enhanced__ = []

# Conversation Summarization (v1.2.0+)
try:
    from .conversation_summarizer import AutoSummarizer, ConversationSummarizer

    __all_summarizer__ = ["ConversationSummarizer", "AutoSummarizer"]
except ImportError:
    __all_summarizer__ = []

# Data Export/Import (v1.2.0+)
try:
    from .data_export_import import DataExporter, DataImporter

    __all_export_import__ = ["DataExporter", "DataImporter"]
except ImportError:
    __all_export_import__ = []

# Response Metrics (v1.3.1+)
try:
    from .response_metrics import ChatResponse, ResponseMetricsAnalyzer, calculate_confidence

    __all_metrics__ = ["ChatResponse", "ResponseMetricsAnalyzer", "calculate_confidence"]
except ImportError:
    __all_metrics__ = []

__version__ = "2.1.4"
__author__ = "Cihat Emre Karataş"

# Multi-backend LLM support (v1.3.0+)
__all_llm_backends__ = ["BaseLLMClient", "LLMClientFactory", "OllamaClientNew", "LMStudioClient"]

# Tool system (v2.0.0+)
try:
    from .builtin_tools import BUILTIN_TOOLS
    from .tool_system import Tool, ToolRegistry, tool
    from .tool_workspace import ToolWorkspace, get_workspace, set_workspace

    __all_tools__ = [
        "tool",
        "Tool",
        "ToolRegistry",
        "BUILTIN_TOOLS",
        "ToolWorkspace",
        "get_workspace",
        "set_workspace",
    ]
except ImportError:
    __all_tools__ = []

# CLI
try:
    from .cli import cli

    __all_cli__ = ["cli"]
except ImportError:
    __all_cli__ = []

# Analytics (v2.1.4+)
try:
    from .conversation_analytics import ConversationAnalytics
    from .config_presets import ConfigPresets
    
    __all_analytics__ = ["ConversationAnalytics", "ConfigPresets"]
except ImportError:
    __all_analytics__ = []

__all__ = (
    [
        "MemAgent",
        "MemoryManager",
        "OllamaClient",
    ]
    + __all_llm_backends__
    + __all_tools__
    + __all_pro__
    + __all_cli__
    + __all_security__
    + __all_enhanced__
    + __all_summarizer__
    + __all_export_import__
    + __all_metrics__
    + __all_analytics__
)
