
    Qi                     n    d 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 erddlmZ  G d d	e      Zy
)z?This module contains the classes for Telegram Stars affiliates.    )TYPE_CHECKINGOptional)Chat)TelegramObject)User)JSONDict)Botc                        e Zd ZdZdZ	 	 	 ddddededed   d	ed
   dee   dee   ddf fdZe		 ddee   ded   ded    f fd       Z
 xZS )AffiliateInfoa
  Contains information about the affiliate that received a commission via this transaction.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`affiliate_user`, :attr:`affiliate_chat`,
    :attr:`commission_per_mille`, :attr:`amount`, and :attr:`nanostar_amount` are equal.

    .. versionadded:: 21.9

    Args:
        affiliate_user (:class:`telegram.User`, optional): The bot or the user that received an
            affiliate commission if it was received by a bot or a user
        affiliate_chat (:class:`telegram.Chat`, optional): The chat that received an affiliate
            commission if it was received by a chat
        commission_per_mille (:obj:`int`): The number of Telegram Stars received by the affiliate
            for each 1000 Telegram Stars received by the bot from referred users
        amount (:obj:`int`): Integer amount of Telegram Stars received by the affiliate from the
            transaction, rounded to 0; can be negative for refunds
        nanostar_amount (:obj:`int`, optional): The number of
            :tg-const:`~telegram.constants.StarTransactions.NANOSTAR_VALUE` shares of Telegram
            Stars received by the affiliate; from
            :tg-const:`~telegram.constants.StarTransactionsLimit.NANOSTAR_MIN_AMOUNT` to
            :tg-const:`~telegram.constants.StarTransactionsLimit.NANOSTAR_MAX_AMOUNT`;
            can be negative for refunds

    Attributes:
        affiliate_user (:class:`telegram.User`): Optional. The bot or the user that received an
            affiliate commission if it was received by a bot or a user
        affiliate_chat (:class:`telegram.Chat`): Optional. The chat that received an affiliate
            commission if it was received by a chat
        commission_per_mille (:obj:`int`): The number of Telegram Stars received by the affiliate
            for each 1000 Telegram Stars received by the bot from referred users
        amount (:obj:`int`): Integer amount of Telegram Stars received by the affiliate from the
            transaction, rounded to 0; can be negative for refunds
        nanostar_amount (:obj:`int`): Optional. The number of
            :tg-const:`~telegram.constants.StarTransactions.NANOSTAR_VALUE` shares of Telegram
            Stars received by the affiliate; from
            :tg-const:`~telegram.constants.StarTransactionsLimit.NANOSTAR_MIN_AMOUNT` to
            :tg-const:`~telegram.constants.StarTransactionsLimit.NANOSTAR_MAX_AMOUNT`;
            can be negative for refunds
    )affiliate_chataffiliate_useramountcommission_per_millenanostar_amountN
api_kwargsr   r   r   r   r   r   r   r   returnc                   t         |   |       || _        || _        || _        || _        || _        | j                  | j                  | j                  | j
                  | j                  f| _        | j                          y )Nr   )	super__init__r   r   r   r   r   	_id_attrs_freeze)selfr   r   r   r   r   r   	__class__s          P/app/.venv/lib/python3.12/site-packages/telegram/_payment/stars/affiliateinfo.pyr   zAffiliateInfo.__init__Q   s}     	J/.<.<)=!!.= %%KK  
 	    databotr	   c                     | j                  |      }|syt        j                  |j                  d      |      |d<   t	        j                  |j                  d      |      |d<   t
        | 	  ||      S )z,See :meth:`telegram.TelegramObject.de_json`.Nr   r   )r   r   )_parse_datar   de_jsongetr   r   )clsr   r   r   s      r   r!   zAffiliateInfo.de_jsonk   sl    
 t$!%dhh7G.H#!N!%dhh7G.H#!NwDc22r   )NNN)N)__name__
__module____qualname____doc__	__slots__intr   r   r   classmethodr!   __classcell__)r   s   @r   r   r      s    'RI ,0+/)- *.!  !(	
 !( "# X& 
4 >B3H%3,4UO3	/	"3 3r   r   N)r'   typingr   r   telegram._chatr   telegram._telegramobjectr   telegram._userr   telegram._utils.typesr   telegramr	   r    r   r   <module>r3      s.   & F *  3  *Y3N Y3r   