from telethon.tl.mtproto_request import MTProtoRequest


class ReqPqRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    req_pq#60469778 nonce:int128 = ResPQ"""

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

    def __init__(self, nonce):
        """
        :param nonce: Telegram type: «int128».
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.nonce = nonce

    def on_send(self, writer):
        writer.write_int(ReqPqRequest.constructor_id, signed=False)
        writer.write_large_int(self.nonce, bits=128)

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

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

    def __repr__(self):
        return 'req_pq#60469778 nonce:int128 = ResPQ'

    def __str__(self):
        return '(req_pq (ID: 0x60469778) = (nonce={}))'.format(str(self.nonce))
