from ...tl.mtproto_request import MTProtoRequest


class WebPagePending(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    webPagePending#c586da1c id:long date:date = WebPage"""

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

    def __init__(self, id, date):
        """
        :param id: Telegram type: «long».
        :param date: Telegram type: «date».

        Constructor for WebPage: Instance of either WebPageEmpty, WebPagePending, WebPage, WebPageNotModified.
        """
        super().__init__()

        self.id = id
        self.date = date

    def on_send(self, writer):
        writer.write_int(WebPagePending.constructor_id, signed=False)
        writer.write_long(self.id)
        writer.tgwrite_date(self.date)

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

    def on_response(self, reader):
        self.id = reader.read_long()
        self.date = reader.tgread_date()

    def __repr__(self):
        return 'webPagePending#c586da1c id:long date:date = WebPage'

    def __str__(self):
        return '(webPagePending (ID: 0xc586da1c) = (id={}, date={}))'.format(str(self.id), str(self.date))
