from ....tl.mtproto_request import MTProtoRequest


class ExportInviteRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite"""

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

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

        :returns ExportedChatInvite: Instance of either ChatInviteEmpty, ChatInviteExported.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.channel = channel

    def on_send(self, writer):
        writer.write_int(ExportInviteRequest.constructor_id, signed=False)
        self.channel.on_send(writer)

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

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

    def __repr__(self):
        return 'channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite'

    def __str__(self):
        return '(channels.exportInvite (ID: 0xc7560885) = (channel={}))'.format(str(self.channel))
