o
    /h+                     @   s   d Z ddlmZmZmZmZmZmZmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ erLddl	mZ G dd deZG dd deZG dd deZG dd deZG dd deZG dd deZdS )zCThis module contains objects that represent paid media in Telegram.    )TYPE_CHECKINGDictFinalOptionalSequenceTupleType)	constants)	PhotoSize)Video)TelegramObject)User)enum)parse_sequence_arg)JSONDict)Botc                	       s   e Zd ZU dZdZejjZee	 e
d< 	 ejjZee	 e
d< 	 ejjZee	 e
d< 	 ddde	d	ee d
df fddZe	ddee ded d
ed  f fddZ  ZS )	PaidMediaa  Describes the paid media added to a message. Currently, it can be one of:

    * :class:`telegram.PaidMediaPreview`
    * :class:`telegram.PaidMediaPhoto`
    * :class:`telegram.PaidMediaVideo`

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

    .. versionadded:: 21.4

    Args:
        type (:obj:`str`): Type of the paid media.

    Attributes:
        type (:obj:`str`): Type of the paid media.
    )typePREVIEWPHOTOVIDEON
api_kwargsr   r   returnc                   s6   t  j|d ttj||| _| jf| _|   d S Nr   )	super__init__r   
get_memberr	   PaidMediaTyper   	_id_attrs_freeze)selfr   r   	__class__ L/var/www/html/govbot/env/lib/python3.10/site-packages/telegram/_paidmedia.pyr   @   s   
zPaidMedia.__init__databotr   c                    sz   |  |}|du rdS |s| tu rdS | jt| jt| jti}| tu r5|d|v r5||	d j
||dS t j
||dS )aX  Converts JSON data to the appropriate :class:`PaidMedia` object, i.e. takes
        care of selecting the correct subclass.

        Args:
            data (Dict[:obj:`str`, ...]): The JSON data.
            bot (:class:`telegram.Bot`, optional): The bot associated with this object.

        Returns:
            The Telegram object.

        Nr   r&   r'   )_parse_datar   r   PaidMediaPreviewr   PaidMediaPhotor   PaidMediaVideogetpopde_jsonr   )clsr&   r'   _class_mappingr"   r$   r%   r/   L   s   
zPaidMedia.de_jsonN)__name__
__module____qualname____doc__	__slots__r	   r   r   r   str__annotations__r   r   r   r   r   classmethodr/   __classcell__r$   r$   r"   r%   r   $   s4   
 r   c                       sX   e Zd ZdZdZ			ddddee dee dee dee d	df
 fd
dZ  Z	S )r*   a  The paid media isn't available before the payment.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`width`, :attr:`height`, and :attr:`duration`
    are equal.

    .. versionadded:: 21.4

    Args:
        type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.PaidMedia.PREVIEW`.
        width (:obj:`int`, optional): Media width as defined by the sender.
        height (:obj:`int`, optional): Media height as defined by the sender.
        duration (:obj:`int`, optional): Duration of the media in seconds as defined by the sender.

    Attributes:
        type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.PaidMedia.PREVIEW`.
        width (:obj:`int`): Optional. Media width as defined by the sender.
        height (:obj:`int`): Optional. Media height as defined by the sender.
        duration (:obj:`int`): Optional. Duration of the media in seconds as defined by the sender.
    )durationheightwidthNr   r>   r=   r<   r   r   c                   sh   t  jtj|d |   || _|| _|| _| j| j| j| jf| _	W d    d S 1 s-w   Y  d S N)r   r   )
r   r   r   r   	_unfrozenr>   r=   r<   r   r   )r!   r>   r=   r<   r   r"   r$   r%   r      s   
"zPaidMediaPreview.__init__)NNN)
r3   r4   r5   r6   r7   r   intr   r   r;   r$   r$   r"   r%   r*   o   s&    r*   c                	       sn   e Zd ZdZdZddded dee ddf fd	d
Ze		ddee ded ded  f fddZ
  ZS )r+   a3  
    The paid media is a photo.

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

    .. versionadded:: 21.4

    Args:
        type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.PaidMedia.PHOTO`.
        photo (Sequence[:class:`telegram.PhotoSize`]): The photo.

    Attributes:
        type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.PaidMedia.PHOTO`.
        photo (Tuple[:class:`telegram.PhotoSize`]): The photo.
    )photoNr   rB   r
   r   r   c                   sX   t  jtj|d |   t|| _| j| jf| _W d    d S 1 s%w   Y  d S r?   )	r   r   r   r   r@   r   rB   r   r   )r!   rB   r   r"   r$   r%   r      s
   

"zPaidMediaPhoto.__init__r&   r'   r   c                    :   |  |}|s	d S tj|d|d|d< t j||dS )NrB   r'   r(   )r)   r
   de_listr-   r   r/   r0   r&   r'   r"   r$   r%   r/      
   
zPaidMediaPhoto.de_jsonr2   )r3   r4   r5   r6   r7   r   r   r   r   r:   r/   r;   r$   r$   r"   r%   r+      s(    r+   c                	       sj   e Zd ZdZdZdddedee ddf fdd	Ze		dd
ee ded ded  f fddZ
  ZS )r,   a  
    The paid media is a video.

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

    .. versionadded:: 21.4

    Args:
        type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.PaidMedia.VIDEO`.
        video (:class:`telegram.Video`): The video.

    Attributes:
        type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.PaidMedia.VIDEO`.
        video (:class:`telegram.Video`): The video.
    )videoNr   rH   r   r   c                   sT   t  jtj|d |   || _| j| jf| _W d    d S 1 s#w   Y  d S r?   )r   r   r   r   r@   rH   r   r   )r!   rH   r   r"   r$   r%   r      s
   
"zPaidMediaVideo.__init__r&   r'   r   c                    s:   |  |}|s	d S tj|d|d|d< t j||dS )NrH   rD   r(   )r)   r   r/   r-   r   rF   r"   r$   r%   r/      rG   zPaidMediaVideo.de_jsonr2   )r3   r4   r5   r6   r7   r   r   r   r   r:   r/   r;   r$   r$   r"   r%   r,      s(    r,   c                	       sr   e Zd ZdZdZdddedee dee	 ddf fd	d
Z
e	ddee	 ded ded  f fddZ  ZS )PaidMediaInfoa  
    Describes the paid media added to a message.

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

    .. versionadded:: 21.4

    Args:
        star_count (:obj:`int`): The number of Telegram Stars that must be paid to buy access to
            the media.
        paid_media (Sequence[:class:`telegram.PaidMedia`]): Information about the paid media.

    Attributes:
        star_count (:obj:`int`): The number of Telegram Stars that must be paid to buy access to
            the media.
        paid_media (Tuple[:class:`telegram.PaidMedia`]): Information about the paid media.
    )
paid_media
star_countNr   rK   rJ   r   r   c                   s8   t  j|d || _t|| _| j| jf| _|   d S r   )r   r   rK   r   rJ   r   r    )r!   rK   rJ   r   r"   r$   r%   r     s
   
zPaidMediaInfo.__init__r&   r'   r   c                    rC   )NrJ   rD   r(   )r)   r   rE   r-   r   r/   rF   r"   r$   r%   r/     rG   zPaidMediaInfo.de_jsonr2   )r3   r4   r5   r6   r7   rA   r   r   r   r   r   r:   r/   r;   r$   r$   r"   r%   rI      s,    rI   c                	       sn   e Zd ZdZdZdddddedee d	df fd
dZe		ddee ded d	ed  f fddZ
  ZS )PaidMediaPurchaseda  This object contains information about a paid media purchase.

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

    Note:
        In Python :keyword:`from` is a reserved word. Use :paramref:`from_user` instead.

    .. versionadded:: 21.6

    Args:
        from_user (:class:`telegram.User`): User who purchased the media.
        paid_media_payload (:obj:`str`): Bot-specified paid media payload.

    Attributes:
        from_user (:class:`telegram.User`): User who purchased the media.
        paid_media_payload (:obj:`str`): Bot-specified paid media payload.
    )	from_userpaid_media_payloadNr   rM   r   rN   r   r   c                   s4   t  j|d || _|| _| j| jf| _|   d S r   )r   r   rM   rN   r   r    )r!   rM   rN   r   r"   r$   r%   r   <  s
   zPaidMediaPurchased.__init__r&   r'   r   c                    s:   |  |}|s	d S tj|d|d|d< t j||dS )Nfromr(   rM   )r)   r   r/   r.   r   rF   r"   r$   r%   r/   J  rG   zPaidMediaPurchased.de_jsonr2   )r3   r4   r5   r6   r7   r8   r   r   r   r:   r/   r;   r$   r$   r"   r%   rL   &  s,    rL   N) r6   typingr   r   r   r   r   r   r   telegramr	   telegram._files.photosizer
   telegram._files.videor   telegram._telegramobjectr   telegram._userr   telegram._utilsr   telegram._utils.argumentparsingr   telegram._utils.typesr   r   r   r*   r+   r,   rI   rL   r$   r$   r$   r%   <module>   s$   $K*..1