from ....tl.mtproto_request import MTProtoRequest


class EditChatAdminRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool"""

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

    def __init__(self, chat_id, user_id, is_admin):
        """
        :param chat_id: Telegram type: «int».
        :param user_id: Telegram type: «InputUser».
        :param is_admin: Telegram type: «Bool».

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

        self.chat_id = chat_id
        self.user_id = user_id
        self.is_admin = is_admin

    def on_send(self, writer):
        writer.write_int(EditChatAdminRequest.constructor_id, signed=False)
        writer.write_int(self.chat_id)
        self.user_id.on_send(writer)
        writer.tgwrite_bool(self.is_admin)

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

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

    def __repr__(self):
        return 'messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool'

    def __str__(self):
        return '(messages.editChatAdmin (ID: 0xa9e69f2e) = (chat_id={}, user_id={}, is_admin={}))'.format(str(self.chat_id), str(self.user_id), str(self.is_admin))
