"""EventBusProvider - NATS/Redis Streams/other."""
from __future__ import annotations

from collections.abc import Awaitable, Callable
from typing import Any, Protocol, runtime_checkable


@runtime_checkable
class EventBusProvider(Protocol):
    """Provider for distributed event bus.

    Backends may include NATS, Redis Streams, Kafka, or other
    message streaming systems.
    """

    @property
    def provider_name(self) -> str:
        ...

    async def connect(self) -> None:
        ...

    async def disconnect(self) -> None:
        ...

    async def publish(
        self,
        topic: str,
        payload: dict[str, Any],
    ) -> bool:
        ...

    async def subscribe(
        self,
        topic: str,
        handler: Callable[[dict[str, Any]], Awaitable[Any]],
    ) -> str:
        ...

    async def unsubscribe(self, subscription_id: str) -> bool:
        ...
