from ....tl.mtproto_request import MTProtoRequest


class ImportAuthorizationRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization"""

    # Telegram's constructor (U)ID for this class
    constructor_id = 0xe3ef9613
    # Also the ID of its resulting type for fast checks
    subclass_of_id = 0xb9e04e39

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

        :returns auth.Authorization: Instance of Authorization.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.id = id
        self.bytes = bytes

    def to_dict(self):
        return {
            'id': self.id,
            'bytes': self.bytes,
        }

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

    @staticmethod
    def empty():
        """Returns an "empty" instance (attributes=None)"""
        return ImportAuthorizationRequest(None, None)

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

    def __repr__(self):
        return 'auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization'

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