from telethon.tl.mtproto_request import MTProtoRequest


class HttpWait(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait"""

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

    def __init__(self, max_delay, wait_after, max_wait):
        """
        :param max_delay: Telegram type: «int».
        :param wait_after: Telegram type: «int».
        :param max_wait: Telegram type: «int».
        """
        super().__init__()

        self.max_delay = max_delay
        self.wait_after = wait_after
        self.max_wait = max_wait

    def on_send(self, writer):
        writer.write_int(HttpWait.constructor_id, signed=False)
        writer.write_int(self.max_delay)
        writer.write_int(self.wait_after)
        writer.write_int(self.max_wait)

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

    def on_response(self, reader):
        self.max_delay = reader.read_int()
        self.wait_after = reader.read_int()
        self.max_wait = reader.read_int()

    def __repr__(self):
        return 'http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait'

    def __str__(self):
        return '(http_wait (ID: 0x9299359f) = (max_delay={}, wait_after={}, max_wait={}))'.format(str(self.max_delay), str(self.wait_after), str(self.max_wait))
