"""
SAGE IO - Input/Output Abstractions

Layer: L3 (Core - Algorithm Library)

This module provides unified input/output interfaces for data streams,
batches, sources, and sinks.

Components:
- Source: Data source abstractions
- Sink: Data sink abstractions
- Batch: Batch processing utilities
"""

# 直接从本包的_version模块加载版本信息
try:
    from sage.libs._version import __author__, __email__, __version__
except ImportError:
    # 备用硬编码版本
    __version__ = "0.1.4"
    __author__ = "IntelliStream Team"
    __email__ = "shuhao_zhang@hust.edu.cn"

from ._fast_json import JSON_BACKEND
from ._fast_json import dumps as json_dumps
from ._fast_json import dumps_str as json_dumps_str
from ._fast_json import loads as json_loads
from ._fast_queue import FastQueue, QueueEmpty, QueueFull, SingleThreadQueue, ThreadSafeFastQueue
from .batch import (
    HFDatasetBatch,
    JSONLBatch,
)
from .sink import (
    FileSink,
    MemWriteSink,
    PrintSink,
    RetriveSink,
    TerminalSink,
)

# Import and export specific classes
from .source import (
    APISource,
    CSVFileSource,
    DatabaseSource,
    FileSource,
    JSONFileSource,
    KafkaSource,
    SocketSource,
    TextFileSource,
)

__all__ = [
    # Version info
    "__version__",
    "__author__",
    "__email__",
    # Sources
    "FileSource",
    "SocketSource",
    "TextFileSource",
    "JSONFileSource",
    "CSVFileSource",
    "KafkaSource",
    "DatabaseSource",
    "APISource",
    # Sinks
    "TerminalSink",
    "RetriveSink",
    "FileSink",
    "MemWriteSink",
    "PrintSink",
    # Batch
    "HFDatasetBatch",
    "JSONLBatch",
    # Fast JSON
    "JSON_BACKEND",
    "json_loads",
    "json_dumps",
    "json_dumps_str",
    # Fast Queue
    "FastQueue",
    "SingleThreadQueue",
    "ThreadSafeFastQueue",
    "QueueEmpty",
    "QueueFull",
]
