from ...tl.mtproto_request import MTProtoRequest


class FoundGifCached(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif"""

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

    def __init__(self, url, photo, document):
        """
        :param url: Telegram type: «string».
        :param photo: Telegram type: «Photo».
        :param document: Telegram type: «Document».

        Constructor for FoundGif: Instance of either FoundGif, FoundGifCached.
        """
        super().__init__()

        self.url = url
        self.photo = photo
        self.document = document

    def on_send(self, writer):
        writer.write_int(FoundGifCached.constructor_id, signed=False)
        writer.tgwrite_string(self.url)
        self.photo.on_send(writer)
        self.document.on_send(writer)

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

    def on_response(self, reader):
        self.url = reader.tgread_string()
        self.photo = reader.tgread_object()
        self.document = reader.tgread_object()

    def __repr__(self):
        return 'foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif'

    def __str__(self):
        return '(foundGifCached (ID: 0x9c750409) = (url={}, photo={}, document={}))'.format(str(self.url), str(self.photo), str(self.document))
