from ....tl.mtproto_request import MTProtoRequest


class GetDhConfigRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig"""

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

    def __init__(self, version, random_length):
        """
        :param version: Telegram type: «int».
        :param random_length: Telegram type: «int».

        :returns messages.DhConfig: Instance of either DhConfigNotModified, DhConfig.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.version = version
        self.random_length = random_length

    def on_send(self, writer):
        writer.write_int(GetDhConfigRequest.constructor_id, signed=False)
        writer.write_int(self.version)
        writer.write_int(self.random_length)

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

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

    def __repr__(self):
        return 'messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig'

    def __str__(self):
        return '(messages.getDhConfig (ID: 0x26cf8950) = (version={}, random_length={}))'.format(str(self.version), str(self.random_length))
