from telethon.tl.mtproto_request import MTProtoRequest


class PingDelayDisconnectRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong"""

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

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

        self.ping_id = ping_id
        self.disconnect_delay = disconnect_delay

    def on_send(self, writer):
        writer.write_int(PingDelayDisconnectRequest.constructor_id, signed=False)
        writer.write_long(self.ping_id)
        writer.write_int(self.disconnect_delay)

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

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

    def __repr__(self):
        return 'ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong'

    def __str__(self):
        return '(ping_delay_disconnect (ID: 0xf3427b8c) = (ping_id={}, disconnect_delay={}))'.format(str(self.ping_id), str(self.disconnect_delay))
