from telethon.tl.mtproto_request import MTProtoRequest


class GetMessagesViewsRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector<int> increment:Bool = Vector<int>"""

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

    def __init__(self, peer, id, increment):
        """
        :param peer: Telegram type: «InputPeer».
        :param id: Telegram type: «int». Must be a list.
        :param increment: Telegram type: «Bool».
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.peer = peer
        self.id = id
        self.increment = increment

    def on_send(self, writer):
        writer.write_int(GetMessagesViewsRequest.constructor_id, signed=False)
        self.peer.on_send(writer)
        writer.write_int(0x1cb5c415, signed=False)  # Vector's constructor ID
        writer.write_int(len(self.id))
        for id_item in self.id:
            writer.write_int(id_item)

        writer.tgwrite_bool(self.increment)

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

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

    def __repr__(self):
        return 'messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector<int> increment:Bool = Vector<int>'

    def __str__(self):
        return '(messages.getMessagesViews (ID: 0xc4c8a55d) = (peer={}, id={}, increment={}))'.format(str(self.peer), None if not self.id else [str(_) for _ in self.id], str(self.increment))
