from telethon.tl.mtproto_request import MTProtoRequest


class GetArchivedStickersRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messages.getArchivedStickers#57f17692 flags:None masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers"""

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

    def __init__(self, offset_id, limit, masks=None):
        """
        :param masks: Telegram type: «true».
        :param offset_id: Telegram type: «long».
        :param limit: Telegram type: «int».
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.masks = masks
        self.offset_id = offset_id
        self.limit = limit

    def on_send(self, writer):
        writer.write_int(GetArchivedStickersRequest.constructor_id, signed=False)
        # Calculate the flags. This equals to those flag arguments which are NOT None
        flags = 0
        flags |= (1 << 0) if self.masks else 0
        writer.write_int(flags)

        writer.write_long(self.offset_id)
        writer.write_int(self.limit)

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

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

    def __repr__(self):
        return 'messages.getArchivedStickers#57f17692 flags:None masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers'

    def __str__(self):
        return '(messages.getArchivedStickers (ID: 0x57f17692) = (masks={}, offset_id={}, limit={}))'.format(str(self.masks), str(self.offset_id), str(self.limit))
