from telethon.tl.mtproto_request import MTProtoRequest


class PingRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    ping#7abe77ec ping_id:long = Pong"""

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

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

        self.ping_id = ping_id

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

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

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

    def __repr__(self):
        return 'ping#7abe77ec ping_id:long = Pong'

    def __str__(self):
        return '(ping (ID: 0x7abe77ec) = (ping_id={}))'.format(str(self.ping_id))
