from telethon.tl.mtproto_request import MTProtoRequest


class FoundGif(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif"""

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

    def __init__(self, url, thumb_url, content_url, content_type, w, h):
        """
        :param url: Telegram type: «string».
        :param thumb_url: Telegram type: «string».
        :param content_url: Telegram type: «string».
        :param content_type: Telegram type: «string».
        :param w: Telegram type: «int».
        :param h: Telegram type: «int».
        """
        super().__init__()

        self.url = url
        self.thumb_url = thumb_url
        self.content_url = content_url
        self.content_type = content_type
        self.w = w
        self.h = h

    def on_send(self, writer):
        writer.write_int(FoundGif.constructor_id, signed=False)
        writer.tgwrite_string(self.url)
        writer.tgwrite_string(self.thumb_url)
        writer.tgwrite_string(self.content_url)
        writer.tgwrite_string(self.content_type)
        writer.write_int(self.w)
        writer.write_int(self.h)

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

    def on_response(self, reader):
        self.url = reader.tgread_string()
        self.thumb_url = reader.tgread_string()
        self.content_url = reader.tgread_string()
        self.content_type = reader.tgread_string()
        self.w = reader.read_int()
        self.h = reader.read_int()

    def __repr__(self):
        return 'foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif'

    def __str__(self):
        return '(foundGif (ID: 0x162ecc1f) = (url={}, thumb_url={}, content_url={}, content_type={}, w={}, h={}))'.format(str(self.url), str(self.thumb_url), str(self.content_url), str(self.content_type), str(self.w), str(self.h))
