U
    2ÒtcP  ã                   @   sd   d Z ddlmZmZmZmZ ddlmZ ddlm	Z	 ddl
mZ erPddlmZ G dd„ deƒZd	S )
zFThis module contains an object that represents a Telegram WebhookInfo.é    )ÚAnyÚListÚOptionalÚTYPE_CHECKING)ÚTelegramObject)ÚJSONDict)Úfrom_timestamp)ÚBotc                   @   sX   e Zd ZdZdZdeeeeeeee eee	dœ
dd„Z
eee ded  dœd	d
„ƒZdS )ÚWebhookInfoaù
  This object represents a Telegram WebhookInfo.

    Contains information about the current status of a webhook.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`url`, :attr:`has_custom_certificate`,
    :attr:`pending_update_count`, :attr:`ip_address`, :attr:`last_error_date`,
    :attr:`last_error_message`, :attr:`max_connections` and :attr:`allowed_updates` are equal.

    Args:
        url (:obj:`str`): Webhook URL, may be empty if webhook is not set up.
        has_custom_certificate (:obj:`bool`): :obj:`True`, if a custom certificate was provided for
            webhook certificate checks.
        pending_update_count (:obj:`int`): Number of updates awaiting delivery.
        ip_address (:obj:`str`, optional): Currently used webhook IP address.
        last_error_date (:obj:`int`, optional): Unix time for the most recent error that happened
            when trying to deliver an update via webhook.
        last_error_message (:obj:`str`, optional): Error message in human-readable format for the
            most recent error that happened when trying to deliver an update via webhook.
        max_connections (:obj:`int`, optional): Maximum allowed number of simultaneous HTTPS
            connections to the webhook for update delivery.
        allowed_updates (List[:obj:`str`], optional): A list of update types the bot is subscribed
            to. Defaults to all update types, except :attr:`telegram.Update.chat_member`.
        last_synchronization_error_date (:obj:`int`, optional): Unix time of the most recent error
            that happened when trying to synchronize available updates with Telegram datacenters.

            .. versionadded:: 13.12

    Attributes:
        url (:obj:`str`): Webhook URL.
        has_custom_certificate (:obj:`bool`): If a custom certificate was provided for webhook.
        pending_update_count (:obj:`int`): Number of updates awaiting delivery.
        ip_address (:obj:`str`): Optional. Currently used webhook IP address.
        last_error_date (:obj:`int`): Optional. Unix time for the most recent error that happened.
        last_error_message (:obj:`str`): Optional. Error message in human-readable format.
        max_connections (:obj:`int`): Optional. Maximum allowed number of simultaneous HTTPS
            connections.
        allowed_updates (List[:obj:`str`]): Optional. A list of update types the bot is subscribed
            to. Defaults to all update types, except :attr:`telegram.Update.chat_member`.
        last_synchronization_error_date (:obj:`int`): Optional. Unix time of the most recent error
            that happened when trying to synchronize available updates with Telegram datacenters.

            .. versionadded:: 13.12

    )
Úallowed_updatesÚurlÚmax_connectionsÚlast_error_dateÚ
ip_addressÚlast_error_messageÚpending_update_countÚhas_custom_certificateÚlast_synchronization_error_dateÚ	_id_attrsN)
r   r   r   r   r   r   r   r   r   Ú_kwargsc
                 K   s`   || _ || _|| _|| _|| _|| _|| _|| _|	| _| j | j| j| j| j| j| j| jf| _	d S )N)
r   r   r   r   r   r   r   r   r   r   )Úselfr   r   r   r   r   r   r   r   r   r   © r   ú8/tmp/pip-unpacked-wheel-2u9rcp5s/telegram/webhookinfo.pyÚ__init__[   s$    øzWebhookInfo.__init__r	   )ÚdataÚbotÚreturnc                 C   sH   |   |¡}|sdS t| d¡ƒ|d< t| d¡ƒ|d< | f d|i|—ŽS )z,See :meth:`telegram.TelegramObject.de_json`.Nr   r   r   )Z_parse_datar   Úget)Úclsr   r   r   r   r   Úde_json€   s    
ÿzWebhookInfo.de_json)NNNNNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__ÚstrÚboolÚintr   r   r   Úclassmethodr   r   r   r   r   r   r   r
      s,   .      öõ%r
   N)r#   Útypingr   r   r   r   Ztelegramr   Ztelegram.utils.typesr   Ztelegram.utils.helpersr   r	   r
   r   r   r   r   Ú<module>   s   