"""Kafka topic definitions and typed payload models.

Provides a :class:`Topic` enum, Pydantic payload models per domain, and
a registry that maps each topic to its expected payload shape so
consumers can validate incoming messages at runtime.

Usage::

    from broker_core import Topic, TelegramMessagePayload, TOPIC_PAYLOAD_MAP

    # Use the enum instead of hardcoded strings
    topic = Topic.TELEGRAM_MESSAGE_RAW_READY
    assert topic == "telegram_message_raw_ready"

    # Look up the payload model for a topic
    model = TOPIC_PAYLOAD_MAP.get(Topic(topic))

    # Validate incoming payloads
    parsed = TelegramMessagePayload.model_validate(raw_dict)
"""

from .enums import Topic
from .models import (
    TelegramParsedMessagePayload,
    BackfillJobPayload,
    CrawlerEventPayload,
    MessageDetailPayload,
    MessageReactionPayload,
    PipelineErrorPayload,
    TelegramAnalyzeReadyPayload,
    TelegramCrawlMetricPayload,
    TelegramMessagePayload,
    TelegramParsedPayload,
)
from .registry import TOPIC_PAYLOAD_MAP, get_payload_model

__all__ = [
    "Topic",
    "BackfillJobPayload",
    "CrawlerEventPayload",
    "MessageDetailPayload",
    "MessageReactionPayload",
    "PipelineErrorPayload",
    "TelegramAnalyzeReadyPayload",
    "TelegramCrawlMetricPayload",
    "TelegramMessagePayload",
    "TelegramParsedMessagePayload",
    "TelegramParsedPayload",
    "TOPIC_PAYLOAD_MAP",
    "get_payload_model",
]
