from .base import BaseSink
from .clickhouse import ClickHouseSink
from .elasticsearch import ElasticsearchSink
from .kafka import KafkaSink
from .mongodb import MongoDBSink
from .postgres import PostgresSink
from .qdrant import QdrantSink
from .registry import get_sink, list_sinks, register_sink
from .weaviate import WeaviateSink
from .webhook import WebhookSink

register_sink("clickhouse", ClickHouseSink)
register_sink("mongodb", MongoDBSink)
register_sink("postgresql", PostgresSink)
register_sink("postgres", PostgresSink)
register_sink("elasticsearch", ElasticsearchSink)
register_sink("es", ElasticsearchSink)
register_sink("qdrant", QdrantSink)
register_sink("weaviate", WeaviateSink)
register_sink("kafka", KafkaSink)
register_sink("webhook", WebhookSink)
register_sink("http_post", WebhookSink)

# Discover third-party sink plugins via entry points
try:
    from importlib.metadata import entry_points as _ep

    for _entry in _ep(group="extractor.sinks"):
        try:
            register_sink(_entry.name, _entry.load())
        except Exception as _exc:
            import logging

            logging.getLogger(__name__).warning(
                "Failed to load sink plugin %r: %s", _entry.name, _exc
            )
except Exception:
    pass

__all__ = [
    "BaseSink",
    "ClickHouseSink",
    "MongoDBSink",
    "PostgresSink",
    "ElasticsearchSink",
    "QdrantSink",
    "WeaviateSink",
    "KafkaSink",
    "WebhookSink",
    "get_sink",
    "list_sinks",
    "register_sink",
]
