from ...tl.mtproto_request import MTProtoRequest


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

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

    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".

        Constructor for HttpWait: Instance of HttpWait.
        """
        super().__init__()

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

    def to_dict(self):
        return {
            'max_delay': self.max_delay,
            'wait_after': self.wait_after,
            'max_wait': self.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 (attributes=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))
