from telethon.tl.mtproto_request import MTProtoRequest


class ClientDHInnerData(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data"""

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

    def __init__(self, nonce, server_nonce, retry_id, g_b):
        """
        :param nonce: Telegram type: «int128».
        :param server_nonce: Telegram type: «int128».
        :param retry_id: Telegram type: «long».
        :param g_b: Telegram type: «string».
        """
        super().__init__()

        self.nonce = nonce
        self.server_nonce = server_nonce
        self.retry_id = retry_id
        self.g_b = g_b

    def on_send(self, writer):
        writer.write_int(ClientDHInnerData.constructor_id, signed=False)
        writer.write_large_int(self.nonce, bits=128)
        writer.write_large_int(self.server_nonce, bits=128)
        writer.write_long(self.retry_id)
        writer.tgwrite_string(self.g_b)

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

    def on_response(self, reader):
        self.nonce = reader.read_large_int(bits=128)
        self.server_nonce = reader.read_large_int(bits=128)
        self.retry_id = reader.read_long()
        self.g_b = reader.tgread_string()

    def __repr__(self):
        return 'client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data'

    def __str__(self):
        return '(client_DH_inner_data (ID: 0x6643b654) = (nonce={}, server_nonce={}, retry_id={}, g_b={}))'.format(str(self.nonce), str(self.server_nonce), str(self.retry_id), str(self.g_b))
