"""GnosisLLM Knowledge - Enterprise-grade knowledge loading, indexing, and search.

This library provides a comprehensive solution for building knowledge-powered
applications with semantic search capabilities.

Quick Start:
    ```python
    from gnosisllm_knowledge import Knowledge

    # Create instance with OpenSearch backend
    knowledge = Knowledge.from_opensearch(
        host="localhost",
        port=9200,
    )

    # Setup backend (creates indices)
    await knowledge.setup()

    # Load and index a sitemap
    await knowledge.load(
        "https://docs.example.com/sitemap.xml",
        collection_id="docs",
    )

    # Search
    results = await knowledge.search("how to configure")
    for item in results.items:
        print(f"{item.title}: {item.score}")
    ```

Features:
    - Semantic, keyword, and hybrid search
    - Multiple content loaders (website, sitemap, files)
    - Intelligent text chunking
    - OpenSearch backend with k-NN vectors
    - Multi-tenancy support
    - Event-driven architecture
    - SOLID principles throughout
"""

from gnosisllm_knowledge.api import Knowledge
from gnosisllm_knowledge.backends import (
    AgenticSearchFallback,
    MemoryIndexer,
    MemorySearcher,
    OpenSearchAgenticSearcher,
    OpenSearchConfig,
    OpenSearchIndexer,
    OpenSearchKnowledgeSearcher,
    OpenSearchSetupAdapter,
)
from gnosisllm_knowledge.chunking import FixedSizeChunker, SentenceChunker
from gnosisllm_knowledge.core.domain.document import Document, DocumentStatus, TextChunk
from gnosisllm_knowledge.core.domain.result import (
    BatchResult,
    IndexResult,
    LoadResult,
    ValidationResult,
)
from gnosisllm_knowledge.core.domain.search import (
    AgentType,
    AgenticSearchQuery,
    AgenticSearchResult,
    ReasoningStep,
    SearchMode,
    SearchQuery,
    SearchResult,
    SearchResultItem,
)
from gnosisllm_knowledge.core.events import Event, EventEmitter, EventType
from gnosisllm_knowledge.core.exceptions import (
    AgenticSearchError,
    ConfigurationError,
    ConnectionError,
    IndexError,
    KnowledgeError,
    LoadError,
    SearchError,
)
from gnosisllm_knowledge.fetchers import (
    HTTPContentFetcher,
    NeoreaderContentFetcher,
    NeoreaderConfig,
)
from gnosisllm_knowledge.loaders import (
    LoaderFactory,
    SitemapLoader,
    WebsiteLoader,
)
from gnosisllm_knowledge.services import (
    KnowledgeIndexingService,
    KnowledgeSearchService,
)

__version__ = "0.2.0"

__all__ = [
    # Main API
    "Knowledge",
    # Domain Models
    "Document",
    "DocumentStatus",
    "TextChunk",
    "SearchQuery",
    "SearchResult",
    "SearchResultItem",
    "SearchMode",
    "AgentType",
    "AgenticSearchQuery",
    "AgenticSearchResult",
    "ReasoningStep",
    "LoadResult",
    "IndexResult",
    "BatchResult",
    "ValidationResult",
    # Events
    "Event",
    "EventType",
    "EventEmitter",
    # Exceptions
    "KnowledgeError",
    "ConfigurationError",
    "ConnectionError",
    "LoadError",
    "IndexError",
    "SearchError",
    "AgenticSearchError",
    # Loaders
    "LoaderFactory",
    "WebsiteLoader",
    "SitemapLoader",
    # Fetchers
    "HTTPContentFetcher",
    "NeoreaderContentFetcher",
    "NeoreaderConfig",
    # Chunkers
    "SentenceChunker",
    "FixedSizeChunker",
    # OpenSearch Backend
    "OpenSearchConfig",
    "OpenSearchIndexer",
    "OpenSearchKnowledgeSearcher",
    "OpenSearchSetupAdapter",
    "OpenSearchAgenticSearcher",
    "AgenticSearchFallback",
    # Memory Backend (for testing)
    "MemoryIndexer",
    "MemorySearcher",
    # Services
    "KnowledgeIndexingService",
    "KnowledgeSearchService",
]
