U
    2ÒtcÑ  ã                   @   sp   d Z ddlZddlmZmZmZ ddlmZmZ ddl	m
Z
mZ ddlmZ er\ddlmZ G dd	„ d	eƒZdS )
zIThis module contains an object that represents an invite link for a chat.é    N)ÚTYPE_CHECKINGÚAnyÚOptional)ÚTelegramObjectÚUser)Úfrom_timestampÚto_timestamp)ÚJSONDict)ÚBotc                       sl   e Zd ZdZdZdeeeeeje	eee	e
dœ
dd„Zeee ded  dœd	d
„ƒZedœ‡ fdd„Z‡  ZS )ÚChatInviteLinku¾	  This object represents an invite link for a chat.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`invite_link`, :attr:`creator`, :attr:`is_primary` and
    :attr:`is_revoked` are equal.

    .. versionadded:: 13.4

    Args:
        invite_link (:obj:`str`): The invite link.
        creator (:class:`telegram.User`): Creator of the link.
        is_primary (:obj:`bool`): :obj:`True`, if the link is primary.
        is_revoked (:obj:`bool`): :obj:`True`, if the link is revoked.
        expire_date (:class:`datetime.datetime`, optional): Date when the link will expire or
            has been expired.
        member_limit (:obj:`int`, optional): Maximum number of users that can be members of the
            chat simultaneously after joining the chat via this invite link; 1-99999.
        name (:obj:`str`, optional): Invite link name.

            .. versionadded:: 13.8
        creates_join_request (:obj:`bool`, optional): :obj:`True`, if users joining the chat via
            the link need to be approved by chat administrators.

            .. versionadded:: 13.8
        pending_join_request_count (:obj:`int`, optional): Number of pending join requests
            created using this link.

            .. versionadded:: 13.8

    Attributes:
        invite_link (:obj:`str`): The invite link. If the link was created by another chat
            administrator, then the second part of the link will be replaced with ``'â€¦'``.
        creator (:class:`telegram.User`): Creator of the link.
        is_primary (:obj:`bool`): :obj:`True`, if the link is primary.
        is_revoked (:obj:`bool`): :obj:`True`, if the link is revoked.
        expire_date (:class:`datetime.datetime`): Optional. Date when the link will expire or
            has been expired.
        member_limit (:obj:`int`): Optional. Maximum number of users that can be members
            of the chat simultaneously after joining the chat via this invite link; 1-99999.
        name (:obj:`str`): Optional. Invite link name.

            .. versionadded:: 13.8
        creates_join_request (:obj:`bool`): Optional. :obj:`True`, if users joining the chat via
            the link need to be approved by chat administrators.

            .. versionadded:: 13.8
        pending_join_request_count (:obj:`int`): Optional. Number of pending join requests
            created using this link.

            .. versionadded:: 13.8

    )
Úinvite_linkÚcreatorÚ
is_primaryÚ
is_revokedÚexpire_dateÚmember_limitÚnameÚcreates_join_requestÚpending_join_request_countÚ	_id_attrsN)
r   r   r   r   r   r   r   r   r   Ú_kwargsc
                 K   sp   || _ || _|| _|| _|| _|d k	r.t|ƒnd | _|| _|| _|	d k	rPt|	ƒnd | _	| j | j| j| jf| _
d S )N)r   r   r   r   r   Úintr   r   r   r   r   )Úselfr   r   r   r   r   r   r   r   r   r   © r   ú;/tmp/pip-unpacked-wheel-2u9rcp5s/telegram/chatinvitelink.pyÚ__init__b   s    ÿzChatInviteLink.__init__r
   )ÚdataÚbotÚreturnc                 C   sF   |   |¡}|sdS t | d¡|¡|d< t| dd¡ƒ|d< | f |ŽS )z,See :meth:`telegram.TelegramObject.de_json`.Nr   r   )Z_parse_datar   Úde_jsonÚgetr   )Úclsr   r   r   r   r   r      s    
zChatInviteLink.de_json)r   c                    s   t ƒ  ¡ }t| jƒ|d< |S )z,See :meth:`telegram.TelegramObject.to_dict`.r   )ÚsuperÚto_dictr   r   )r   r   ©Ú	__class__r   r   r#   Œ   s    
zChatInviteLink.to_dict)NNNNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__Ústrr   ÚboolÚdatetimer   r   r   Úclassmethodr   r	   r   r#   Ú__classcell__r   r   r$   r   r      s,   5     öõr   )r)   r-   Útypingr   r   r   Ztelegramr   r   Ztelegram.utils.helpersr   r   Ztelegram.utils.typesr	   r
   r   r   r   r   r   Ú<module>   s   