"""kanban-analytics — server-side Python analytics SDK.

Quick start::

    from kanban_analytics import analytics

    analytics.init('your-api-key', endpoint='https://…/api/ingest')
    analytics.track('event_name', user_id='u1', properties={'key': 'val'})

For async frameworks (FastAPI, Starlette)::

    from kanban_analytics import async_analytics

    await async_analytics.init('your-api-key', endpoint='https://…/api/ingest')
    await async_analytics.track('event_name', user_id='u1')
"""

from __future__ import annotations

# -- Singletons (recommended for most use cases) ---------------------------

from .async_client import AsyncAnalyticsClient, AsyncScopedAnalyticsClient
from .catalog import EventCatalog, create_catalog
from .client import AnalyticsClient, ScopedAnalyticsClient
from .crash import CrashReporter
from .flags import FlagManager, murmurhash3
from .context import __version__
from .errors import (
    AnalyticsError,
    AuthenticationError,
    NetworkError,
    RateLimitError,
    TimeoutError,
    ValidationError,
)
from .types import (
    AsyncMiddlewareFn,
    EventType,
    FlushResult,
    IdentityParams,
    MiddlewareFn,
    Properties,
    SDKInfo,
    SDKOptions,
    ServerContext,
    ServerEvent,
    ServerInfo,
    TrackParams,
)

# Module-level singleton instances
analytics = AnalyticsClient()
async_analytics = AsyncAnalyticsClient()

__all__ = [
    # Singletons
    "analytics",
    "async_analytics",
    # Client classes
    "AnalyticsClient",
    "AsyncAnalyticsClient",
    "ScopedAnalyticsClient",
    "AsyncScopedAnalyticsClient",
    # Catalog
    "EventCatalog",
    "create_catalog",
    # Crash reporting
    "CrashReporter",
    # Feature flags
    "FlagManager",
    "murmurhash3",
    # Errors
    "AnalyticsError",
    "AuthenticationError",
    "ValidationError",
    "NetworkError",
    "RateLimitError",
    "TimeoutError",
    # Types
    "EventType",
    "Properties",
    "ServerContext",
    "ServerInfo",
    "SDKInfo",
    "IdentityParams",
    "TrackParams",
    "SDKOptions",
    "ServerEvent",
    "FlushResult",
    "MiddlewareFn",
    "AsyncMiddlewareFn",
    # Version
    "__version__",
]
