from telethon.tl.mtproto_request import MTProtoRequest


class SaveGifRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool"""

    # Telegram's constructor ID (and unique identifier) for this class
    constructor_id = 0x327a30cb

    def __init__(self, id, unsave):
        """
        :param id: Telegram type: «InputDocument».
        :param unsave: Telegram type: «Bool».
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.id = id
        self.unsave = unsave

    def on_send(self, writer):
        writer.write_int(SaveGifRequest.constructor_id, signed=False)
        self.id.on_send(writer)
        writer.tgwrite_bool(self.unsave)

    @staticmethod
    def empty():
        """Returns an "empty" instance (all attributes are None)"""
        return SaveGifRequest(None, None)

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

    def __repr__(self):
        return 'messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool'

    def __str__(self):
        return '(messages.saveGif (ID: 0x327a30cb) = (id={}, unsave={}))'.format(str(self.id), str(self.unsave))
