from ....tl.mtproto_request import MTProtoRequest


class ExportedAuthorization(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization"""

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

    def __init__(self, id, bytes):
        """
        :param id: Telegram type: «int».
        :param bytes: Telegram type: «bytes».

        Constructor for auth.ExportedAuthorization: Instance of ExportedAuthorization.
        """
        super().__init__()

        self.id = id
        self.bytes = bytes

    def on_send(self, writer):
        writer.write_int(ExportedAuthorization.constructor_id, signed=False)
        writer.write_int(self.id)
        writer.tgwrite_bytes(self.bytes)

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

    def on_response(self, reader):
        self.id = reader.read_int()
        self.bytes = reader.tgread_bytes()

    def __repr__(self):
        return 'auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization'

    def __str__(self):
        return '(auth.exportedAuthorization (ID: 0xdf969c2d) = (id={}, bytes={}))'.format(str(self.id), str(self.bytes))
