from ....tl.mtproto_request import MTProtoRequest


class ReceivedMessagesRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    messages.receivedMessages#05a954c0 max_id:int = Vector<ReceivedNotifyMessage>"""

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

    def __init__(self, max_id):
        """
        :param max_id: Telegram type: "int".

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

        self.max_id = max_id

    def to_dict(self):
        return {
            'max_id': self.max_id,
        }

    def on_send(self, writer):
        writer.write_int(ReceivedMessagesRequest.constructor_id, signed=False)
        writer.write_int(self.max_id)

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

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

    def __repr__(self):
        return 'messages.receivedMessages#05a954c0 max_id:int = Vector<ReceivedNotifyMessage>'

    def __str__(self):
        return '(messages.receivedMessages (ID: 0x5a954c0) = (max_id={}))'.format(str(self.max_id))
