"""Telegram media file domain — model, schemas, validators, and repository."""

from repo_core.domains.telegram.media.model import TelegramMediaFile
from repo_core.domains.telegram.media.schema import (
    CreateMediaFileRequest,
    MediaFileResponse,
    PatchMediaFileRequest,
)
from repo_core.domains.telegram.media.validator import (
    MediaFilePayloadValidator,
    MediaTypeValidator,
    MessageIdValidator,
    PeerIdValidator,
    StorageKeyValidator,
    build_media_file_pipeline,
)
from repo_core.domains.telegram.media.repository import TelegramMediaFileRepository

__all__ = [
    "TelegramMediaFile",
    "CreateMediaFileRequest",
    "MediaFileResponse",
    "PatchMediaFileRequest",
    "MediaFilePayloadValidator",
    "StorageKeyValidator",
    "FileSizeValidator",
    "PeerIdValidator",
    "MessageIdValidator",
    "build_media_file_pipeline",
    "TelegramMediaFileRepository",
]


def create_repository() -> TelegramMediaFileRepository:
    """Create a TelegramMediaFileRepository auto-wired from environment variables.

    Requires ``DATABASE_URL`` for PostgreSQL and ``DORIS_URL`` for the
    warehouse backend.

    Usage::

        repo = create_repository()
        async with repo:
            media = await repo.get_media_by_message(peer_id=123, message_id=456)
    """
    return TelegramMediaFileRepository(model=TelegramMediaFile)
