#  RubigramClient - Rubika API library for python
#  Copyright (C) 2025-present Javad <https://github.com/DevJavad>
#  Github - https://github.com/DevJavad/rubigram


from typing import Optional, Union, BinaryIO
import rubigram


class SendPhoto:
    """
    Photo sender for Rubika API.

    This class provides an asynchronous method to send photos/images
    to a chat. It is a specialized wrapper around `send_file` that
    automatically sets the file type to Image and supports captions,
    keypads, notifications, replies, and auto-deletion.
    """

    __slots__ = ()

    async def send_photo(
        self: "rubigram.Client",
        chat_id: str,
        photo: Union[str, bytes, BinaryIO],
        caption: Optional[str] = None,
        filename: Optional[str] = None,
        chat_keypad: Optional["rubigram.types.Keypad"] = None,
        inline_keypad: Optional["rubigram.types.Keypad"] = None,
        chat_keypad_type: Optional["rubigram.enums.ChatKeypadType"] = None,
        disable_notification: bool = False,
        reply_to_message_id: Optional[str] = None,
        auto_delete: Optional[int] = None
    ) -> "rubigram.types.UMessage":
        """
        Send a photo/image to a chat on Rubika.

        Parameters:
            chat_id (str):
                Unique identifier of the target chat.
            photo (Union[str, bytes, BinaryIO]):
                Photo source. Can be a local file path, URL, bytes,
                file-like object, or an existing File ID.
            caption (Optional[str], default=None):
                Caption or text to send with the photo.
            filename (Optional[str], default=None):
                Custom filename for the uploaded photo.
            chat_keypad (Optional[rubigram.types.Keypad], default=None):
                Custom chat keypad to attach to the message.
            inline_keypad (Optional[rubigram.types.Keypad], default=None):
                Inline keypad to attach to the message.
            chat_keypad_type (Optional[rubigram.enums.ChatKeypadType], default=None):
                Type of chat keypad.
            disable_notification (bool, default=False):
                If True, sends the message silently.
            reply_to_message_id (Optional[str], default=None):
                Message ID to reply to.
            auto_delete (Optional[int], default=None):
                Time in seconds after which the message will be
                automatically deleted.

        Returns:
            rubigram.types.UMessage:
                The sent photo message object.

        Example:
        .. code-block:: python
            # Send a local photo
            message = await client.send_photo(chat_id="chat_id", photo="image.jpg")

            # Send a photo from URL
            message = await client.send_photo(chat_id="chat_id", photo="https://example.com/image.png")

            # Send an existing photo by File ID
            message = await client.send_photo(chat_id="chat_id", photo="file_id")

            # Send photo bytes
            message = await client.send_photo(chat_id="chat_id", photo=b"binary data")
        """
        return await self.send_file(
            chat_id,
            photo,
            caption,
            filename,
            "Image",
            chat_keypad,
            inline_keypad,
            chat_keypad_type,
            disable_notification,
            reply_to_message_id,
            auto_delete
        )