from ...tl.tlobject import TLObject


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

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

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

        Constructor for FoundGif: Instance of either FoundGif, FoundGifCached.
        """
        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 to_dict(self):
        return {
            'url': self.url,
            'thumb_url': self.thumb_url,
            'content_url': self.content_url,
            'content_type': self.content_type,
            'w': self.w,
            'h': self.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 (attributes=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 TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)
