from telethon.tl.mtproto_request import MTProtoRequest


class ToggleChatAdminsRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates"""

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

    def __init__(self, chat_id, enabled):
        """
        :param chat_id: Telegram type: «int».
        :param enabled: Telegram type: «Bool».
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.chat_id = chat_id
        self.enabled = enabled

    def on_send(self, writer):
        writer.write_int(ToggleChatAdminsRequest.constructor_id, signed=False)
        writer.write_int(self.chat_id)
        writer.tgwrite_bool(self.enabled)

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

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

    def __repr__(self):
        return 'messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates'

    def __str__(self):
        return '(messages.toggleChatAdmins (ID: 0xec8bd9e1) = (chat_id={}, enabled={}))'.format(str(self.chat_id), str(self.enabled))
