from ....tl.mtproto_request import MTProtoRequest


class ReceivedQueueRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messages.receivedQueue#55a5bb66 max_qts:int = Vector<long>"""

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

    def __init__(self, max_qts):
        """
        :param max_qts: Telegram type: «int».

        :returns Vector<long>: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.max_qts = max_qts

    def on_send(self, writer):
        writer.write_int(ReceivedQueueRequest.constructor_id, signed=False)
        writer.write_int(self.max_qts)

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

    def on_response(self, reader):
        reader.read_int()  # Vector id
        count = reader.read_long()
        self.result = [reader.read_long() for _ in range(count)]

    def __repr__(self):
        return 'messages.receivedQueue#55a5bb66 max_qts:int = Vector<long>'

    def __str__(self):
        return '(messages.receivedQueue (ID: 0x55a5bb66) = (max_qts={}))'.format(str(self.max_qts))
