from ...tl.tlobject import TLObject


class ReqDHParamsRequest(TLObject):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params"""

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

    def __init__(self, nonce, server_nonce, p, q, public_key_fingerprint, encrypted_data):
        """
        :param nonce: Telegram type: "int128".
        :param server_nonce: Telegram type: "int128".
        :param p: Telegram type: "string".
        :param q: Telegram type: "string".
        :param public_key_fingerprint: Telegram type: "long".
        :param encrypted_data: Telegram type: "string".

        :returns Server_DH_Params: Instance of either ServerDHParamsFail, ServerDHParamsOk.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.nonce = nonce
        self.server_nonce = server_nonce
        self.p = p
        self.q = q
        self.public_key_fingerprint = public_key_fingerprint
        self.encrypted_data = encrypted_data

    def to_dict(self):
        return {
            'nonce': self.nonce,
            'server_nonce': self.server_nonce,
            'p': self.p,
            'q': self.q,
            'public_key_fingerprint': self.public_key_fingerprint,
            'encrypted_data': self.encrypted_data,
        }

    def on_send(self, writer):
        writer.write_int(ReqDHParamsRequest.constructor_id, signed=False)
        writer.write_large_int(self.nonce, bits=128)
        writer.write_large_int(self.server_nonce, bits=128)
        writer.tgwrite_string(self.p)
        writer.tgwrite_string(self.q)
        writer.write_long(self.public_key_fingerprint)
        writer.tgwrite_string(self.encrypted_data)

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

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

    def __repr__(self):
        return 'req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params'

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)
