from ....tl.mtproto_request import MTProtoRequest


class UnregisterDeviceRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    account.unregisterDevice#65c55b40 token_type:int token:string = Bool"""

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

    def __init__(self, token_type, token):
        """
        :param token_type: Telegram type: «int».
        :param token: Telegram type: «string».

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

        self.token_type = token_type
        self.token = token

    def on_send(self, writer):
        writer.write_int(UnregisterDeviceRequest.constructor_id, signed=False)
        writer.write_int(self.token_type)
        writer.tgwrite_string(self.token)

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

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

    def __repr__(self):
        return 'account.unregisterDevice#65c55b40 token_type:int token:string = Bool'

    def __str__(self):
        return '(account.unregisterDevice (ID: 0x65c55b40) = (token_type={}, token={}))'.format(str(self.token_type), str(self.token))
