from ....tl.mtproto_request import MTProtoRequest


class EditAdminRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    channels.editAdmin#eb7611d0 channel:InputChannel user_id:InputUser role:ChannelParticipantRole = Updates"""

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

    def __init__(self, channel, user_id, role):
        """
        :param channel: Telegram type: «InputChannel».
        :param user_id: Telegram type: «InputUser».
        :param role: Telegram type: «ChannelParticipantRole».

        :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, UpdatesTg, UpdateShortSentMessage.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.channel = channel
        self.user_id = user_id
        self.role = role

    def on_send(self, writer):
        writer.write_int(EditAdminRequest.constructor_id, signed=False)
        self.channel.on_send(writer)
        self.user_id.on_send(writer)
        self.role.on_send(writer)

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

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

    def __repr__(self):
        return 'channels.editAdmin#eb7611d0 channel:InputChannel user_id:InputUser role:ChannelParticipantRole = Updates'

    def __str__(self):
        return '(channels.editAdmin (ID: 0xeb7611d0) = (channel={}, user_id={}, role={}))'.format(str(self.channel), str(self.user_id), str(self.role))
