U
    g                     @   sr   d Z ddlmZmZmZmZ ddlmZ ddlm	Z	 ddl
mZ erPddlmZ eddd	d
ZG dd deZdS )z3Common base class for media objects with thumbnails    )TYPE_CHECKINGOptionalTypeTypeVar)_BaseMedium)	PhotoSize)JSONDict)BotThumbedMT_co_BaseThumbedMediumT)bound	covariantc                       st   e Zd ZdZdZdddeeee ee ee	 d fddZ
edee ee	 ed ee d	 fd
dZ  ZS )r   a  
    Base class for objects representing the various media file types that may include a thumbnail.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`file_unique_id` is equal.

    Args:
        file_id (:obj:`str`): Identifier for this file, which can be used to download
            or reuse the file.
        file_unique_id (:obj:`str`): Unique identifier for this file, which
            is supposed to be the same over time and for different bots.
            Can't be used to download or reuse the file.
        file_size (:obj:`int`, optional): File size.
        thumbnail (:class:`telegram.PhotoSize`, optional): Thumbnail as defined by the sender.

            .. versionadded:: 20.2

    Attributes:
        file_id (:obj:`str`): File identifier.
        file_unique_id (:obj:`str`): Unique identifier for this file, which
            is supposed to be the same over time and for different bots.
            Can't be used to download or reuse the file.
        file_size (:obj:`int`): Optional. File size.
        thumbnail (:class:`telegram.PhotoSize`): Optional. Thumbnail as defined by the sender.

            .. versionadded:: 20.2

    )	thumbnailN)
api_kwargs)file_idfile_unique_id	file_sizer   r   c                   s   t  j||||d || _d S )N)r   r   r   r   )super__init__r   )selfr   r   r   r   r   	__class__ F/tmp/pip-unpacked-wheel-swnnwir2/telegram/_files/_basethumbedmedium.pyr   A   s    	z_BaseThumbedMedium.__init__r	   )clsdatabotreturnc                    sj   |  |}|sdS t|dts8t|d||d< i }|ddk	rX|d|d< t j|||dS )z,See :meth:`telegram.TelegramObject.de_json`.Nr   Zthumb)r   r   r   )Z_parse_data
isinstancegetr   de_jsonpopr   Z_de_json)r   r   r   r   r   r   r   r    S   s    
z_BaseThumbedMedium.de_json)NN)N)__name__
__module____qualname____doc__	__slots__strr   intr   r   r   classmethodr   r
   r    __classcell__r   r   r   r   r   !   s*        N)r%   typingr   r   r   r   Ztelegram._files._basemediumr   Ztelegram._files.photosizer   Ztelegram._utils.typesr   Ztelegramr	   r
   r   r   r   r   r   <module>   s   