from ....tl.tlobject import TLObject
from ....utils import get_input_peer
import os


class SendScreenshotNotificationRequest(TLObject):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates"""

    # Telegram's constructor (U)ID for this class
    constructor_id = 0xc97df020
    # Also the ID of its resulting type for fast checks
    subclass_of_id = 0x8af52aac

    def __init__(self, peer, reply_to_msg_id, random_id=None):
        """
        :param peer: Telegram type: "InputPeer".
        :param reply_to_msg_id: Telegram type: "int".
        :param random_id: Telegram type: "long".

        :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, UpdatesTg, UpdateShortSentMessage.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.peer = get_input_peer(peer)
        self.reply_to_msg_id = reply_to_msg_id
        self.random_id = random_id if random_id is not None else int.from_bytes(os.urandom(8), signed=True, byteorder='little')

    def to_dict(self):
        return {
            'peer': None if self.peer is None else self.peer.to_dict(),
            'reply_to_msg_id': self.reply_to_msg_id,
            'random_id': self.random_id,
        }

    def on_send(self, writer):
        writer.write_int(SendScreenshotNotificationRequest.constructor_id, signed=False)
        self.peer.on_send(writer)
        writer.write_int(self.reply_to_msg_id)
        writer.write_long(self.random_id)

    @staticmethod
    def empty():
        """Returns an "empty" instance (attributes=None)"""
        return SendScreenshotNotificationRequest(None, None, None)

    def on_response(self, reader):
        self.result = reader.tgread_object()

    def __repr__(self):
        return 'messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates'

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)
