U
    gS                     @   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 erhd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dS )zEThis module contains objects that represents a Telegram ReactionType.    )TYPE_CHECKINGDictFinalLiteralOptionalTypeUnion)	constants)TelegramObject)enum)JSONDict)Botc                       s   e Zd ZU dZdZejjZeej e	d< ejj
Z
eej e	d< ejjZeej e	d< ddeed ejf ee d	 fd
dZedee ed ed  d fddZ  ZS )ReactionTypea  Base class for Telegram ReactionType Objects.
    There exist :class:`telegram.ReactionTypeEmoji`, :class:`telegram.ReactionTypeCustomEmoji`
    and :class:`telegram.ReactionTypePaid`.

    .. versionadded:: 20.8
    .. versionchanged:: 21.5

        Added paid reaction.

    Args:
        type (:obj:`str`): Type of the reaction. Can be
            :attr:`~telegram.ReactionType.EMOJI`, :attr:`~telegram.ReactionType.CUSTOM_EMOJI` or
            :attr:`~telegram.ReactionType.PAID`.
    Attributes:
        type (:obj:`str`): Type of the reaction. Can be
            :attr:`~telegram.ReactionType.EMOJI`, :attr:`~telegram.ReactionType.CUSTOM_EMOJI` or
            :attr:`~telegram.ReactionType.PAID`.

    )typeEMOJICUSTOM_EMOJIPAIDN
api_kwargs)emojiZcustom_emojiZpaidr   r   c                   s,   t  j|d ttj||| _|   d S Nr   )super__init__r   Z
get_memberr	   r   r   _freeze)selfr   r   	__class__ 6/tmp/pip-unpacked-wheel-swnnwir2/telegram/_reaction.pyr   A   s    zReactionType.__init__r   databotreturnc                    sx   |  |}|dkrdS |s&| tkr&dS | jt| jt| jti}| tkrh|d|krh||	d 
||S t j
||dS z,See :meth:`telegram.TelegramObject.de_json`.Nr   )r!   r"   )_parse_datar   r   ReactionTypeEmojir   ReactionTypeCustomEmojir   ReactionTypePaidgetpopde_jsonr   )clsr!   r"   Z_class_mappingr   r   r   r+   O   s    
   zReactionType.de_json)N)__name__
__module____qualname____doc__	__slots__r	   r   r   r   __annotations__r   r   r   r   r   r   r   classmethodr+   __classcell__r   r   r   r   r       s&   
  r   c                       s6   e Zd ZdZdZddeee d fddZ  Z	S )r&   aP  
    Represents a reaction with a normal emoji.

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

    .. versionadded:: 20.8

    Args:
        emoji (:obj:`str`): Reaction emoji. It can be one of
            :const:`telegram.constants.ReactionEmoji`.

    Attributes:
        type (:obj:`str`): Type of the reaction,
            always :tg-const:`telegram.ReactionType.EMOJI`.
        emoji (:obj:`str`): Reaction emoji. It can be one of
        :const:`telegram.constants.ReactionEmoji`.
    )r   Nr   )r   r   c             	      s:   t  jtj|d |   || _| jf| _W 5 Q R X d S Nr   )r   r   r   r   	_unfrozenr   	_id_attrs)r   r   r   r   r   r   r   ~   s    
zReactionTypeEmoji.__init__
r-   r.   r/   r0   r1   strr   r   r   r4   r   r   r   r   r&   h   s   r&   c                       s6   e Zd ZdZdZddeee d fddZ  Z	S )r'   a  
    Represents a reaction with a custom emoji.

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

    .. versionadded:: 20.8

    Args:
        custom_emoji_id (:obj:`str`): Custom emoji identifier.

    Attributes:
        type (:obj:`str`): Type of the reaction,
            always :tg-const:`telegram.ReactionType.CUSTOM_EMOJI`.
        custom_emoji_id (:obj:`str`): Custom emoji identifier.

    )custom_emoji_idNr   )r:   r   c             	      s:   t  jtj|d |   || _| jf| _W 5 Q R X d S r5   )r   r   r   r   r6   r:   r7   )r   r:   r   r   r   r   r      s    
z ReactionTypeCustomEmoji.__init__r8   r   r   r   r   r'      s   r'   c                       s4   e Zd ZdZdZddee d fddZ  ZS )r(   z
    The reaction is paid.

    .. versionadded:: 21.5

    Attributes:
        type (:obj:`str`): Type of the reaction,
            always :tg-const:`telegram.ReactionType.PAID`.
    r   Nr   c                   s   t  jtj|d |   d S r5   )r   r   r   r   r   )r   r   r   r   r   r      s    zReactionTypePaid.__init__)	r-   r.   r/   r0   r1   r   r   r   r4   r   r   r   r   r(      s   
r(   c                       s`   e Zd ZdZdZddeeee d fddZ	e
dee ed ed  d	 fd
dZ  ZS )ReactionCountai  This class represents a reaction added to a message along with the number of times it was
    added.

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

    .. versionadded:: 20.8

    Args:
        type (:class:`telegram.ReactionType`): Type of the reaction.
        total_count (:obj:`int`): Number of times the reaction was added.

    Attributes:
        type (:class:`telegram.ReactionType`): Type of the reaction.
        total_count (:obj:`int`): Number of times the reaction was added.
    )total_countr   Nr   )r   r<   r   c                   s4   t  j|d || _|| _| j| jf| _|   d S r   )r   r   r   r<   r7   r   )r   r   r<   r   r   r   r   r      s    zReactionCount.__init__r   r    c                    s8   |  |}|sdS t|d||d< t j||dS r$   )r%   r   r+   r)   r   )r,   r!   r"   r   r   r   r+      s
    
zReactionCount.de_json)N)r-   r.   r/   r0   r1   r   intr   r   r   r3   r+   r4   r   r   r   r   r;      s   
  r;   N)r0   typingr   r   r   r   r   r   r   Ztelegramr	   Ztelegram._telegramobjectr
   Ztelegram._utilsr   Ztelegram._utils.typesr   r   r   r&   r'   r(   r;   r   r   r   r   <module>   s   $H#"