from ....tl.mtproto_request import MTProtoRequest


class GetAllChatsRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messages.getAllChats#eba80ff0 except_ids:Vector<int> = messages.Chats"""

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

    def __init__(self, except_ids):
        """
        :param except_ids: Telegram type: «int». Must be a list.

        :returns messages.Chats: Instance of either Chats, ChatsSlice.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.except_ids = except_ids

    def on_send(self, writer):
        writer.write_int(GetAllChatsRequest.constructor_id, signed=False)
        writer.write_int(0x1cb5c415, signed=False)  # Vector's constructor ID
        writer.write_int(len(self.except_ids))
        for except_ids_item in self.except_ids:
            writer.write_int(except_ids_item)

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

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

    def __repr__(self):
        return 'messages.getAllChats#eba80ff0 except_ids:Vector<int> = messages.Chats'

    def __str__(self):
        return '(messages.getAllChats (ID: 0xeba80ff0) = (except_ids={}))'.format(None if not self.except_ids else [str(_) for _ in self.except_ids])
