"""
SageTSDB Middleware Service

Provides the middleware service interface for SageTSDB.
Imports from isage-tsdb PyPI package (>= 0.1.7) when available,
otherwise falls back to the local python/ implementation.
"""

try:
    # isage-tsdb >= 0.1.7 exposes service and core types directly
    from sage_tsdb import SageTSDBService, SageTSDBServiceConfig, TimeSeriesDB
    SageTSDB = TimeSeriesDB
except ImportError:
    # Fallback to local implementation bundled with sage-middleware
    from .python.micro_service.sage_tsdb_service import (
        SageTSDBService,
        SageTSDBServiceConfig,
    )
    from .python.sage_tsdb import SageTSDB  # type: ignore[no-redef]

__all__ = ["SageTSDB", "SageTSDBService", "SageTSDBServiceConfig"]
