from __future__ import annotations

from typing import Any

from armorer.messaging.gateway import MessagingGateway
from armorer.messaging.signal import SignalGateway
from armorer.messaging.telegram import TelegramGateway


def create_messaging_gateway(provider: str, **kwargs: Any) -> MessagingGateway:
    """
    Factory for messaging provider adapters.

    Supported now:
    - telegram

    Planned:
    - signal
    """
    normalized = (provider or "").strip().lower()
    if normalized == "telegram":
        return TelegramGateway(**kwargs)
    if normalized == "signal":
        return SignalGateway(**kwargs)
    raise ValueError(f"Unsupported messaging provider '{provider}'. Supported: telegram, signal.")
