
    if                        d Z ddlZddlmZ ddl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mZ ddlmZmZ ddlmZ ddlmZ ddlmZmZ ddlm Z  erddlm!Z!  G d de          Z" G d de          Z# G d de          Z$ G d de          Z% G d de          Z& G d de          Z' G d de          Z(dS )z4This module contains classes related to unique gifs.    N)Sequence)TYPE_CHECKINGFinal)	constants)Chat)Sticker)TelegramObject)enum)de_json_optionalparse_sequence_arg)extract_tzinfo_from_defaultsfrom_timestamp)JSONDict)warn)!build_deprecation_warning_message&warn_about_deprecated_attr_in_property)PTBDeprecationWarning)Botc                   h     e Zd ZdZdZdddedededee         d	ed
ee         dedz  f fdZ	 xZ
S )UniqueGiftColorsa4  This object contains information about the color scheme for a user's name, message replies
    and link previews based on a unique gift.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal if their :attr:`model_custom_emoji_id`, :attr:`symbol_custom_emoji_id`,
    :attr:`light_theme_main_color`, :attr:`light_theme_other_colors`,
    :attr:`dark_theme_main_color`, and :attr:`dark_theme_other_colors` are equal.

    .. versionadded:: 22.6

    Args:
        model_custom_emoji_id (:obj:`str`): Custom emoji identifier of the unique gift's model.
        symbol_custom_emoji_id (:obj:`str`): Custom emoji identifier of the unique gift's symbol.
        light_theme_main_color (:obj:`int`): Main color used in light themes; RGB format.
        light_theme_other_colors (Sequence[:obj:`int`]): List of 1-3 additional colors used in
            light themes; RGB format. |sequenceclassargs|
        dark_theme_main_color (:obj:`int`): Main color used in dark themes; RGB format.
        dark_theme_other_colors (Sequence[:obj:`int`]): List of 1-3 additional colors used in dark
            themes; RGB format. |sequenceclassargs|

    Attributes:
        model_custom_emoji_id (:obj:`str`): Custom emoji identifier of the unique gift's model.
        symbol_custom_emoji_id (:obj:`str`): Custom emoji identifier of the unique gift's symbol.
        light_theme_main_color (:obj:`int`): Main color used in light themes; RGB format.
        light_theme_other_colors (Tuple[:obj:`int`]): Tuple of 1-3 additional colors used in
            light themes; RGB format.
        dark_theme_main_color (:obj:`int`): Main color used in dark themes; RGB format.
        dark_theme_other_colors (Tuple[:obj:`int`]): Tuple of 1-3 additional colors used in dark
            themes; RGB format.
    )dark_theme_main_colordark_theme_other_colorslight_theme_main_colorlight_theme_other_colorsmodel_custom_emoji_idsymbol_custom_emoji_idN
api_kwargsr   r   r   r   r   r   r   c                R   t                                          |           || _        || _        || _        t          |          | _        || _        t          |          | _        | j        | j        | j        | j        | j        | j        f| _	        | 
                                 d S Nr   )super__init__r   r   r   r   r   r   r   	_id_attrs_freeze)	selfr   r   r   r   r   r   r   	__class__s	           T/Users/shanyulin/my-agent/.venv/lib/python3.11/site-packages/telegram/_uniquegift.pyr"   zUniqueGiftColors.__init__V   s     	J///*?"+A#+A#9K$:
 :
% +@"8JKb8c8c$ &'')&(
 	    )__name__
__module____qualname____doc__	__slots__strintr   r   r"   __classcell__r&   s   @r'   r   r   -   s         >I$ '+  " !$ !$	
 #+3-  # "*# tO         r(   r   c            
       n     e Zd ZdZdZdddededededz  f fd	Z	e
dd
edddd f fd            Z xZS )UniqueGiftModelaS  This object describes the model of a unique gift.

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

    .. versionadded:: 22.1

    Args:
        name (:obj:`str`): Name of the model.
        sticker (:class:`telegram.Sticker`): The sticker that represents the unique gift.
        rarity_per_mille (:obj:`int`): The number of unique gifts that receive this
            model for every ``1000`` gifts upgraded.

    Attributes:
        name (:obj:`str`): Name of the model.
        sticker (:class:`telegram.Sticker`): The sticker that represents the unique gift.
        rarity_per_mille (:obj:`int`): The number of unique gifts that receive this
            model for every ``1000`` gifts upgraded.

    namerarity_per_millestickerNr   r5   r7   r6   r   c                    t                                          |           || _        || _        || _        | j        | j        | j        f| _        |                                  d S r    r!   r"   r5   r7   r6   r#   r$   r%   r5   r7   r6   r   r&   s        r'   r"   zUniqueGiftModel.__init__   \     	J///	 '%5)T\43HIr(   databot
Bot | Nonereturnc                     |                      |          }t          |                    d          t          |          |d<   t	                                          ||          S ,See :meth:`telegram.TelegramObject.de_json`.r7   r<   r=   _parse_datar   getr   r!   de_jsonclsr<   r=   r&   s      r'   rG   zUniqueGiftModel.de_json   Q     t$$*488I+>+>MMYwwDc222r(   Nr)   r*   r+   r,   r-   r.   r   r/   r   r"   classmethodrG   r0   r1   s   @r'   r3   r3   w   s         *I '+    	 tO     " 3 38 3, 3BS 3 3 3 3 3 [3 3 3 3 3r(   r3   c            
       n     e Zd ZdZdZdddededededz  f fd	Z	e
dd
edddd f fd            Z xZS )UniqueGiftSymbolak  This object describes the symbol shown on the pattern of a unique gift.

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

    .. versionadded:: 22.1

    Args:
        name (:obj:`str`): Name of the symbol.
        sticker (:class:`telegram.Sticker`): The sticker that represents the unique gift.
        rarity_per_mille (:obj:`int`): The number of unique gifts that receive this
            model for every ``1000`` gifts upgraded.

    Attributes:
        name (:obj:`str`): Name of the symbol.
        sticker (:class:`telegram.Sticker`): The sticker that represents the unique gift.
        rarity_per_mille (:obj:`int`): The number of unique gifts that receive this
            model for every ``1000`` gifts upgraded.

    r4   Nr   r5   r7   r6   r   c                    t                                          |           || _        || _        || _        | j        | j        | j        f| _        |                                  d S r    r9   r:   s        r'   r"   zUniqueGiftSymbol.__init__   r;   r(   r<   r=   r>   r?   c                     |                      |          }t          |                    d          t          |          |d<   t	                                          ||          S rA   rD   rH   s      r'   rG   zUniqueGiftSymbol.de_json   rJ   r(   rK   rL   r1   s   @r'   rO   rO      s         *I '+    	 tO     " 3 38 3, 3BT 3 3 3 3 3 [3 3 3 3 3r(   rO   c                   H     e Zd ZdZdZdddedededed	edz  f
 fd
Z xZS )UniqueGiftBackdropColorsa"  This object describes the colors of the backdrop of a unique gift.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal if their :attr:`center_color`, :attr:`edge_color`, :attr:`symbol_color`,
    and :attr:`text_color` are equal.

    .. versionadded:: 22.1

    Args:
        center_color (:obj:`int`): The color in the center of the backdrop in RGB format.
        edge_color (:obj:`int`): The color on the edges of the backdrop in RGB format.
        symbol_color (:obj:`int`): The color to be applied to the symbol in RGB format.
        text_color (:obj:`int`): The color for the text on the backdrop in RGB format.

    Attributes:
        center_color (:obj:`int`): The color in the center of the backdrop in RGB format.
        edge_color (:obj:`int`): The color on the edges of the backdrop in RGB format.
        symbol_color (:obj:`int`): The color to be applied to the symbol in RGB format.
        text_color (:obj:`int`): The color for the text on the backdrop in RGB format.

    )center_color
edge_colorsymbol_color
text_colorNr   rT   rU   rV   rW   r   c                    t                                          |           || _        || _        || _        || _        | j        | j        | j        | j        f| _        |                                  d S r    )r!   r"   rT   rU   rV   rW   r#   r$   )r%   rT   rU   rV   rW   r   r&   s         r'   r"   z!UniqueGiftBackdropColors.__init__  sk     	J///!-)!-)+T_d>OQUQ`ar(   )	r)   r*   r+   r,   r-   r/   r   r"   r0   r1   s   @r'   rS   rS      s         ,I '+    	
  tO         r(   rS   c            
       n     e Zd ZdZdZdddededededz  f fd	Z	e
dd
edddd f fd            Z xZS )UniqueGiftBackdropaX  This object describes the backdrop of a unique gift.

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

    .. versionadded:: 22.1

    Args:
        name (:obj:`str`): Name of the backdrop.
        colors (:class:`telegram.UniqueGiftBackdropColors`): Colors of the backdrop.
        rarity_per_mille (:obj:`int`): The number of unique gifts that receive this backdrop
            for every ``1000`` gifts upgraded.

    Attributes:
        name (:obj:`str`): Name of the backdrop.
        colors (:class:`telegram.UniqueGiftBackdropColors`): Colors of the backdrop.
        rarity_per_mille (:obj:`int`): The number of unique gifts that receive this backdrop
            for every ``1000`` gifts upgraded.

    )colorsr5   r6   Nr   r5   r[   r6   r   c                    t                                          |           || _        || _        || _        | j        | j        | j        f| _        |                                  d S r    )r!   r"   r5   r[   r6   r#   r$   )r%   r5   r[   r6   r   r&   s        r'   r"   zUniqueGiftBackdrop.__init__3  s\     	J///	06%5)T[$2GHr(   r<   r=   r>   r?   c                     |                      |          }t          |                    d          t          |          |d<   t	                                          ||          S )rB   r[   rC   )rE   r   rF   rS   r!   rG   rH   s      r'   rG   zUniqueGiftBackdrop.de_jsonD  sS     t$$)$((8*<*<>VX[\\XwwDc222r(   rK   )r)   r*   r+   r,   r-   r.   rS   r/   r   r"   rM   rG   r0   r1   s   @r'   rZ   rZ     s         *I '+   ) 	 tO     " 3 38 3, 3BV 3 3 3 3 3 [3 3 3 3 3r(   rZ   c                        e Zd ZdZdZ	 	 	 	 	 ddddedededed	ed
e	de
dz  dedz  dedz  dedz  dedz  dedz  f fdZeddedddd f fd            Z xZS )
UniqueGifta  This object describes a unique gift that was upgraded from a regular gift.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal if their :attr:`base_name`, :attr:`name`, :attr:`number`, :class:`model`,
    :attr:`symbol`, and :attr:`backdrop` are equal.

    .. versionadded:: 22.1

    Args:
        gift_id (:obj:`str`): Identifier of the regular gift from which the gift was upgraded.

            .. versionadded:: 22.6
        base_name (:obj:`str`): Human-readable name of the regular gift from which this unique
            gift was upgraded.
        name (:obj:`str`): Unique name of the gift. This name can be used
            in ``https://t.me/nft/...`` links and story areas.
        number (:obj:`int`): Unique number of the upgraded gift among gifts upgraded from the
            same regular gift.
        model (:class:`UniqueGiftModel`): Model of the gift.
        symbol (:class:`UniqueGiftSymbol`): Symbol of the gift.
        backdrop (:class:`UniqueGiftBackdrop`): Backdrop of the gift.
        publisher_chat (:class:`telegram.Chat`, optional): Information about the chat that
            published the gift.

            .. versionadded:: 22.4
        is_premium (:obj:`bool`, optional): :obj:`True`, if the original regular gift was
            exclusively purchaseable by Telegram Premium subscribers.

            .. versionadded:: 22.6
        is_from_blockchain (:obj:`bool`, optional): :obj:`True`, if the gift is assigned from the
            TON blockchain and can't be resold or transferred in Telegram.

            .. versionadded:: 22.6
        colors (:class:`telegram.UniqueGiftColors`, optional): The color scheme that can be used
            by the gift's owner for the chat's name, replies to messages and link previews; for
            business account gifts and gifts that are currently on sale only.

            .. versionadded:: 22.6

    Attributes:
        gift_id (:obj:`str`): Identifier of the regular gift from which the gift was upgraded.

            .. versionadded:: 22.6
        base_name (:obj:`str`): Human-readable name of the regular gift from which this unique
            gift was upgraded.
        name (:obj:`str`): Unique name of the gift. This name can be used
            in ``https://t.me/nft/...`` links and story areas.
        number (:obj:`int`): Unique number of the upgraded gift among gifts upgraded from the
            same regular gift.
        model (:class:`telegram.UniqueGiftModel`): Model of the gift.
        symbol (:class:`telegram.UniqueGiftSymbol`): Symbol of the gift.
        backdrop (:class:`telegram.UniqueGiftBackdrop`): Backdrop of the gift.
        publisher_chat (:class:`telegram.Chat`): Optional. Information about the chat that
            published the gift.

            .. versionadded:: 22.4
        is_premium (:obj:`bool`): Optional. :obj:`True`, if the original regular gift was
            exclusively purchaseable by Telegram Premium subscribers.

            .. versionadded:: 22.6
        is_from_blockchain (:obj:`bool`): Optional. :obj:`True`, if the gift is assigned from the
            TON blockchain and can't be resold or transferred in Telegram.

            .. versionadded:: 22.6
        colors (:class:`telegram.UniqueGiftColors`): Optional. The color scheme that can be used
            by the gift's owner for the chat's name, replies to messages and link previews; for
            business account gifts and gifts that are currently on sale only.

            .. versionadded:: 22.6

    )backdrop	base_namer[   gift_idis_from_blockchain
is_premiummodelr5   numberpublisher_chatsymbolNr   ra   r5   rf   re   rh   r`   rg   rb   rc   rd   r[   r   c                   |t          d          t                                          |           || _        || _        || _        || _        || _        || _        || _	        || _
        |	| _        |
| _        || _        | j        | j        | j        | j        | j        | j	        f| _        |                                  d S )Nz2`gift_id` is a required argument since Bot API 9.3r   )	TypeErrorr!   r"   rb   ra   r5   rf   re   rh   r`   rg   rc   rd   r[   r#   r$   )r%   ra   r5   rf   re   rh   r`   rg   rb   rc   rd   r[   r   r&   s                r'   r"   zUniqueGift.__init__  s    & ?PQQQJ///#'	!&+
(.,4+9/A'1/5 NIKJKM
 	r(   r<   r=   r>   r?   c                 ,   |                      |          }t          |                    d          t          |          |d<   t          |                    d          t          |          |d<   t          |                    d          t
          |          |d<   t          |                    d          t          |          |d<   t          |                    d          t          |          |d<   t                      	                    ||          S )rB   re   rh   r`   rg   r[   rC   )
rE   r   rF   r3   rO   rZ   r   r   r!   rG   rH   s      r'   rG   zUniqueGift.de_json  s     t$$('):):OSQQW)$((8*<*<>NPSTTX+DHHZ,@,@BTVYZZZ!1$((;K2L2LdTW!X!X)$((8*<*<>NPSTTXwwDc222r(   )NNNNNrK   )r)   r*   r+   r,   r-   r.   r/   r3   rO   rZ   r   boolr   r   r"   rM   rG   r0   r1   s   @r'   r_   r_   N  sL       F FPI, '+ #*."&*.,  '+!, , ,, , 	,
 , !, %, t, t, !4K, 4K, !4',  tO!, , , , , ,\ 
3 
38 
3, 
3, 
3 
3 
3 
3 
3 [
3 
3 
3 
3 
3r(   r_   c                       e Zd ZU 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<   	 ej        j        Zee         e	d<   	 ej        j        Zee         e	d<   	 dZ	 	 	 	 	 	 ddd	d
edededz  dedz  dedz  dej        dz  dedz  dedz  dedz  f fdZededz  fd            Zeddedddd f fd            Z xZS )UniqueGiftInfoas  Describes a service message about a unique gift that was sent or received.

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

    .. versionadded:: 22.1

    Args:
        gift (:class:`UniqueGift`): Information about the gift.
        origin (:obj:`str`): Origin of the gift. Currently, either :attr:`UPGRADE` for gifts
            upgraded from regular gifts, :attr:`TRANSFER` for gifts transferred from other users
            or channels, :attr:`RESALE` for gifts bought from other users,
            :attr:`GIFTED_UPGRADE` for upgrades purchased after the gift was sent, or :attr:`OFFER`
            for gifts bought or sold through gift purchase offers

            .. versionchanged:: 22.3
                The :attr:`RESALE` origin was added.
            .. versionchanged:: 22.6
                Bot API 9.3 added the :attr:`GIFTED_UPGRADE` and :attr:`OFFER` origins.
        owned_gift_id (:obj:`str`, optional) Unique identifier of the received gift for the
            bot; only present for gifts received on behalf of business accounts.
        transfer_star_count (:obj:`int`, optional): Number of Telegram Stars that must be paid
            to transfer the gift; omitted if the bot cannot transfer the gift.
        last_resale_star_count (:obj:`int`, optional): For gifts bought from other users, the price
            paid for the gift.

            .. versionadded:: 22.3
            .. deprecated:: 22.6
                Bot API 9.3 deprecated this field. Use :attr:`last_resale_currency` and
                :attr:`last_resale_amount` instead.
        last_resale_currency (:obj:`str`, optional): For gifts bought from other users, the
            currency in which the payment for the gift was done. Currently, one of ``XTR`` for
            Telegram Stars or ``TON`` for toncoins.

            .. versionadded:: 22.6
        last_resale_amount (:obj:`int`, optional): For gifts bought from other users, the price
            paid for the gift in either Telegram Stars or nanotoncoins.

            .. versionadded:: 22.6
        next_transfer_date (:obj:`datetime.datetime`, optional): Date when the gift can be
            transferred. If it's in the past, then the gift can be transferred now.
            |datetime_localization|

            .. versionadded:: 22.3

    Attributes:
        gift (:class:`UniqueGift`): Information about the gift.
        origin (:obj:`str`): Origin of the gift. Currently, either :attr:`UPGRADE` for gifts
            upgraded from regular gifts, :attr:`TRANSFER` for gifts transferred from other users
            or channels, :attr:`RESALE` for gifts bought from other users,
            :attr:`GIFTED_UPGRADE` for upgrades purchased after the gift was sent, or :attr:`OFFER`
            for gifts bought or sold through gift purchase offers

            .. versionchanged:: 22.3
                The :attr:`RESALE` origin was added.
            .. versionchanged:: 22.6
                Bot API 9.3 added the :attr:`GIFTED_UPGRADE` and :attr:`OFFER` origins.
        owned_gift_id (:obj:`str`) Optional. Unique identifier of the received gift for the
            bot; only present for gifts received on behalf of business accounts.
        transfer_star_count (:obj:`int`): Optional. Number of Telegram Stars that must be paid
            to transfer the gift; omitted if the bot cannot transfer the gift.
        last_resale_currency (:obj:`str`): Optional. For gifts bought from other users, the
            currency in which the payment for the gift was done. Currently, one of ``XTR`` for
            Telegram Stars or ``TON`` for toncoins.

            .. versionadded:: 22.6
        last_resale_amount (:obj:`int`): Optional. For gifts bought from other users, the price
            paid for the gift in either Telegram Stars or nanotoncoins.

            .. versionadded:: 22.6
        next_transfer_date (:obj:`datetime.datetime`): Optional. Date when the gift can be
            transferred. If it's in the past, then the gift can be transferred now.
            |datetime_localization|

            .. versionadded:: 22.3
    GIFTED_UPGRADEOFFERRESALETRANSFERUPGRADE)_last_resale_star_countgiftlast_resale_amountlast_resale_currencynext_transfer_dateoriginowned_gift_idtransfer_star_countNr   ru   ry   rz   r{   last_resale_star_countrx   rw   rv   r   c	                   |1t          t          dt          dddd                    d	           t                                          |	
           || _        t          j        t          j	        ||          | _
        || _        || _        || _        || _        || _        || _        | j        | j
        f| _        |                                  d S )N22.6r|   last_resale_currency/amount9.3	parameter)deprecated_namenew_namebot_api_versionobject_type)versionmessage   )
stacklevelr   )r   r   r   r!   r"   ru   r
   
get_memberr   UniqueGiftInfoOriginry   rz   r{   rt   rx   rw   rv   r#   r$   )r%   ru   ry   rz   r{   r|   rx   rw   rv   r   r&   s             r'   r"   zUniqueGiftInfo.__init__N  s     "-%"=(@!>(-$/	         	J/// $	?9+I6SYZZ)6/B 3I$7I0D!.@)T[1r(   r?   c                 6    t          dddd           | j        S )a'  :obj:`int`: Optional. For gifts bought from other users, the price
        paid for the gift.

        .. versionadded:: 22.3
        .. deprecated:: 22.6
            Bot API 9.3 deprecated this field. Use :attr:`last_resale_currency` and
            :attr:`last_resale_amount` instead.
        r|   r   r   r~   )deprecated_attr_namenew_attr_namer   ptb_version)r   rt   )r%   s    r'   r|   z%UniqueGiftInfo.last_resale_star_count{  s2     	/!97!		
 	
 	
 	
 ++r(   r<   r=   r>   c                 8   |                      |          }t          |          }t          |                    d          t          |          |d<   t          |                    d          |          |d<   t                                          ||          S )rB   ru   rx   )tzinforC   )rE   r   r   rF   r_   r   r!   rG   )rI   r<   r=   
loc_tzinfor&   s       r'   rG   zUniqueGiftInfo.de_json  s     t$$1#66
'(8(8*cJJV%3HH)**:&
 &
 &
!" wwDc222r(   )NNNNNNrK   )r)   r*   r+   r,   r   r   ro   r   r.   __annotations__rp   rq   rr   rs   r-   r_   r/   dtmdatetimer   r"   propertyr|   rM   rG   r0   r1   s   @r'   rn   rn     s        K KZ "+!?!NNE#JNNN "6<E5:<<< #7>FE#J>>> %9BHeCjBBBC#8@GU3Z@@@B	I %)*.-126+/)-* '+* * ** * Tz	*
 !4Z* !$d
*  L4/* "Dj*  $J* tO* * * * * *Z ,d
 , , , X," 
3 
38 
3, 
3BR 
3 
3 
3 
3 
3 [
3 
3 
3 
3 
3r(   rn   ))r,   r   r   collections.abcr   typingr   r   telegramr   telegram._chatr   telegram._files.stickerr   telegram._telegramobjectr	   telegram._utilsr
   telegram._utils.argumentparsingr   r   telegram._utils.datetimer   r   telegram._utils.typesr   telegram._utils.warningsr   #telegram._utils.warnings_transitionr   r   telegram.warningsr   r   r   r3   rO   rS   rZ   r_   rn    r(   r'   <module>r      s  ( ; :     $ $ $ $ $ $ ' ' ' ' ' ' ' '             + + + + + + 3 3 3 3 3 3             P P P P P P P P Q Q Q Q Q Q Q Q * * * * * * ) ) ) ) ) )        4 3 3 3 3 3 G G G G G~ G G GT43 43 43 43 43n 43 43 43n43 43 43 43 43~ 43 43 43n/ / / / /~ / / /d43 43 43 43 43 43 43 43nP3 P3 P3 P3 P3 P3 P3 P3fw3 w3 w3 w3 w3^ w3 w3 w3 w3 w3r(   