o
    N,hA                     @   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 dd
lmZmZ ddlmZ erJd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)Chat)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__ `/var/www/www-root/data/www/bot.pdev.uz/venv/lib/python3.10/site-packages/telegram/_uniquegift.pyr   B      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/   S      
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   y   r$   zUniqueGiftSymbol.__init__r%   r&   r   r'   c                    r(   r)   r,   r0   r    r"   r#   r/      r2   zUniqueGiftSymbol.de_jsonr3   r4   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   rA   rB   rC   rD   r   c                   sH   t  j|d || _|| _|| _|| _| j| j| j| jf| _|   d S r   )r   r   rA   rB   rC   rD   r   r   )r   rA   rB   rC   rD   r   r    r"   r#   r      s   	z!UniqueGiftBackdropColors.__init__)
r5   r6   r7   r8   r9   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   rF   r   r   c                   r   r   )r   r   r   rF   r   r   r   )r   r   rF   r   r   r    r"   r#   r      r$   zUniqueGiftBackdrop.__init__r%   r&   r   r'   c                    r(   )r*   rF   r+   )r-   r
   r.   r@   r   r/   r0   r    r"   r#   r/      r2   zUniqueGiftBackdrop.de_jsonr3   )r5   r6   r7   r8   r9   r:   r@   r;   r   r   r   r<   r/   r=   r"   r"   r    r#   rE      r>   rE   c                       s|   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
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.
        publisher_chat (:class:`telegram.Chat`, optional): Information about the chat that
            published the gift.

            .. versionadded:: 22.4

    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.
        publisher_chat (:class:`telegram.Chat`): Optional. Information about the chat that
            published the gift.

            .. versionadded:: 22.4

    )backdrop	base_namemodelr   numberpublisher_chatsymbolNr   rI   r   rK   rJ   rM   rH   rL   r   c          	         sb   t  j|d || _|| _|| _|| _|| _|| _|| _| j| j| j| j| j| jf| _	| 
  d S r   )r   r   rI   r   rK   rJ   rM   rH   rL   r   r   )	r   rI   r   rK   rJ   rM   rH   rL   r   r    r"   r#   r   0  s    	zUniqueGift.__init__r%   r&   r   r'   c                    sr   |  |}t|dt||d< t|dt||d< t|dt||d< t|dt||d< t j||dS )r*   rJ   rM   rH   rL   r+   )	r-   r
   r.   r   r?   rE   r   r   r/   r0   r    r"   r#   r/   P  s   
zUniqueGift.de_jsonr3   )r5   r6   r7   r8   r9   r:   r;   r   r?   rE   r   r   r   r   r<   r/   r=   r"   r"   r    r#   rG      s2    (

 *rG   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   rR   rU   rV   rW   rS   rT   r   c                   sX   t  j|d || _ttj||| _|| _|| _	|| _
|| _| j| jf| _|   d S r   )r   r   rR   r	   
get_memberr   UniqueGiftInfoOriginrU   rV   rW   rS   rT   r   r   )r   rR   rU   rV   rW   rS   rT   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*   rR   rT   )tzinfor+   )r-   r   r
   r.   rG   r   r   r/   )r1   r%   r&   
loc_tzinfor    r"   r#   r/     s   


zUniqueGiftInfo.de_json)NNNNr3   )r5   r6   r7   r8   r   rY   rO   r   r:   __annotations__rP   rQ   r9   rG   r   r;   dtmdatetimer   r   r<   r/   r=   r"   r"   r    r#   rN   ]  s@   
 4		*rN   )r8   r^   r]   typingr   r   r   telegramr   telegram._chatr   telegram._files.stickerr   telegram._telegramobjectr   telegram._utilsr	   telegram._utils.argumentparsingr
   telegram._utils.datetimer   r   telegram._utils.typesr   r   r   r?   r@   rE   rG   rN   r"   r"   r"   r#   <module>   s&   7727`