o
    "h?                     @   s   d Z ddlZddl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mZ dd
lmZ erDd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 )z4This module contains classes related to unique gifs.    N)TYPE_CHECKINGFinalOptional)	constants)Sticker)TelegramObject)enum)de_json_optional)extract_tzinfo_from_defaultsfrom_timestamp)JSONDict)Botc                
       d   e Zd ZdZdZdddedededee	 f fd	d
Z
edde	ded dd f fddZ  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stickerN
api_kwargsr   r   r   r   c                   >   t  j|d || _|| _|| _| j| j| jf| _|   d S Nr   super__init__r   r   r   	_id_attrs_freezeselfr   r   r   r   	__class__ G/var/www/html/venv/lib/python3.10/site-packages/telegram/_uniquegift.pyr   @      zUniqueGiftModel.__init__databotr   returnc                    0   |  |}t|dt||d< t j||dS ,See :meth:`telegram.TelegramObject.de_json`.r   r$   r%   _parse_datar	   getr   r   de_jsonclsr$   r%   r   r!   r"   r.   Q      
zUniqueGiftModel.de_jsonN__name__
__module____qualname____doc__	__slots__strr   intr   r   r   classmethodr.   __classcell__r!   r!   r   r"   r   $       *r   c                
       r   )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.

    r   Nr   r   r   r   r   c                   r   r   r   r   r   r!   r"   r   w   r#   zUniqueGiftSymbol.__init__r$   r%   r   r&   c                    r'   r(   r+   r/   r   r!   r"   r.      r1   zUniqueGiftSymbol.de_jsonr2   r3   r!   r!   r   r"   r>   [   r=   r>   c                       sD   e Zd ZdZdZdddedededed	ee f
 fd
dZ  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   r@   rA   rB   rC   r   c                   sH   t  j|d || _|| _|| _|| _| j| j| j| jf| _|   d S r   )r   r   r@   rA   rB   rC   r   r   )r   r@   rA   rB   rC   r   r   r!   r"   r      s   	z!UniqueGiftBackdropColors.__init__)
r4   r5   r6   r7   r8   r:   r   r   r   r<   r!   r!   r   r"   r?      s    r?   c                
       r   )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.

    )colorsr   r   Nr   r   rE   r   r   c                   r   r   )r   r   r   rE   r   r   r   )r   r   rE   r   r   r   r!   r"   r      r#   zUniqueGiftBackdrop.__init__r$   r%   r   r&   c                    r'   )r)   rE   r*   )r,   r	   r-   r?   r   r.   r/   r   r!   r"   r.      r1   zUniqueGiftBackdrop.de_jsonr2   )r4   r5   r6   r7   r8   r9   r?   r:   r   r   r   r;   r.   r<   r!   r!   r   r"   rD      r=   rD   c                       sp   e Zd ZdZdZdddedededed	ed
e	de
e f fddZeddede
d dd f fddZ  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:
        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.

    Attributes:
        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.

    )backdrop	base_namemodelr   numbersymbolNr   rH   r   rJ   rI   rK   rG   r   c                   s\   t  j|d || _|| _|| _|| _|| _|| _| j| j| j| j| j| jf| _| 	  d S r   )
r   r   rH   r   rJ   rI   rK   rG   r   r   )r   rH   r   rJ   rI   rK   rG   r   r   r!   r"   r   %  s   	zUniqueGift.__init__r$   r%   r   r&   c                    s\   |  |}t|dt||d< t|dt||d< t|dt||d< t j||dS )r)   rI   rK   rG   r*   )r,   r	   r-   r   r>   rD   r   r.   r/   r   r!   r"   r.   C  s
   
zUniqueGift.de_jsonr2   )r4   r5   r6   r7   r8   r9   r:   r   r>   rD   r   r   r   r;   r.   r<   r!   r!   r   r"   rF      s*     	*rF   c                       s   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< 	 dZ				dddded	ed
ee dee dee deej dee f fddZeddeded dd f fddZ  ZS )UniqueGiftInfoao
  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, or :attr:`RESALE` for gifts bought from other users.

            .. versionchanged:: 22.3
                The :attr:`RESALE` origin was added.
        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
        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, or :attr:`RESALE` for gifts bought from other users.

            .. versionchanged:: 22.3
                The :attr:`RESALE` origin was added.
        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
        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
    UPGRADETRANSFERRESALE)giftlast_resale_star_countnext_transfer_dateoriginowned_gift_idtransfer_star_countNr   rP   rS   rT   rU   rQ   rR   r   c                   sX   t  j|d || _ttj||| _|| _|| _	|| _
|| _| j| jf| _|   d S r   )r   r   rP   r   
get_memberr   UniqueGiftInfoOriginrS   rT   rU   rQ   rR   r   r   )r   rP   rS   rT   rU   rQ   rR   r   r   r!   r"   r     s   zUniqueGiftInfo.__init__r$   r%   r   r&   c                    sN   |  |}t|}t|dt||d< t|d|d|d< t j||dS )r)   rP   rR   )tzinfor*   )r,   r
   r	   r-   rF   r   r   r.   )r0   r$   r%   
loc_tzinfor   r!   r"   r.     s   


zUniqueGiftInfo.de_json)NNNNr2   )r4   r5   r6   r7   r   rW   rM   r   r9   __annotations__rN   rO   r8   rF   r   r:   dtmdatetimer   r   r;   r.   r<   r!   r!   r   r"   rL   O  s@   
 4		*rL   )r7   r\   r[   typingr   r   r   telegramr   telegram._files.stickerr   telegram._telegramobjectr   telegram._utilsr   telegram._utils.argumentparsingr	   telegram._utils.datetimer
   r   telegram._utils.typesr   r   r   r>   r?   rD   rF   rL   r!   r!   r!   r"   <module>   s$   7727T