o
    Zzj  ã                   @   sp   d 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 er.ddlmZ G d	d
„ d
eƒZdS )z?This module contains the classes for Telegram Stars affiliates.é    )ÚTYPE_CHECKING)ÚChat)ÚTelegramObject)ÚUser)Úde_json_optional)ÚJSONDict)ÚBotc                       sx   e Zd ZdZdZ			dddœdededdd	d
dedB dedB ddf‡ fdd„Zeddedddd f‡ fdd„ƒZ	‡  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.Nanostar.VALUE` shares of Telegram
            Stars received by the affiliate; from
            :tg-const:`~telegram.constants.NanostarLimit.MIN_AMOUNT` to
            :tg-const:`~telegram.constants.NanostarLimit.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.Nanostar.VALUE` shares of Telegram
            Stars received by the affiliate; from
            :tg-const:`~telegram.constants.NanostarLimit.MIN_AMOUNT` to
            :tg-const:`~telegram.constants.NanostarLimit.MAX_AMOUNT`;
            can be negative for refunds
    )Úaffiliate_chatÚaffiliate_userÚamountÚcommission_per_milleÚnanostar_amountN©Ú
api_kwargsr   r   r   zUser | Noner
   zChat | Noner   r   Úreturnc                   sR   t ƒ j|d� || _|| _|| _|| _|| _| j| j| j| j| jf| _|  ¡  d S )Nr   )	ÚsuperÚ__init__r   r
   r   r   r   Ú	_id_attrsÚ_freeze)Úselfr   r   r   r
   r   r   ©Ú	__class__© ú`/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telegram/_payment/stars/affiliateinfo.pyr   S   s   
ûzAffiliateInfo.__init__ÚdataÚbotz
Bot | Nonec                    sF   |   |¡}t| d¡t|ƒ|d< t| d¡t|ƒ|d< tƒ j||d�S )z,See :meth:`telegram.TelegramObject.de_json`.r   r
   )r   r   )Ú_parse_datar   Úgetr   r   r   Úde_json)Úclsr   r   r   r   r   r   m   s   
zAffiliateInfo.de_json)NNN)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__Úintr   r   Úclassmethodr   Ú__classcell__r   r   r   r   r	   !   s2    )úøþýüûúø	÷&r	   N)r$   Útypingr   Útelegram._chatr   Útelegram._telegramobjectr   Útelegram._userr   Útelegram._utils.argumentparsingr   Útelegram._utils.typesr   Útelegramr   r	   r   r   r   r   Ú<module>   s   