o
    "hi[                     @   s  d Z ddlZddlm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 dd	lmZ dd
lmZmZmZ ddlmZmZ ddlmZ erRd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"G dd deZ#dS )z;This module contains the Telegram Business related classes.    N)Sequence)TYPE_CHECKINGOptional)Chat)Location)Sticker)TelegramObject)User)de_json_optionalde_list_optionalparse_sequence_arg)extract_tzinfo_from_defaultsfrom_timestamp)JSONDict)Botc                !       s   e Zd ZdZdZ														ddddee dee dee dee d	ee d
ee dee dee dee dee dee dee dee dee dee f fddZ  Z	S )BusinessBotRightsaW  
    This object represents the rights of a business bot.

    Objects of this class are comparable in terms of equality.
    Two objects of this class are considered equal, if all their attributes are equal.

    .. versionadded:: 22.1

    Args:
        can_reply (:obj:`bool`, optional): True, if the bot can send and edit messages in the
            private chats that had incoming messages in the last 24 hours.
        can_read_messages (:obj:`bool`, optional): True, if the bot can mark incoming private
            messages as read.
        can_delete_sent_messages (:obj:`bool`, optional): True, if the bot can delete messages
            sent by the bot.
        can_delete_all_messages (:obj:`bool`, optional): True, if the bot can delete all private
            messages in managed chats.
        can_edit_name (:obj:`bool`, optional): True, if the bot can edit the first and last name
            of the business account.
        can_edit_bio (:obj:`bool`, optional): True, if the bot can edit the bio of the
            business account.
        can_edit_profile_photo (:obj:`bool`, optional): True, if the bot can edit the profile
            photo of the business account.
        can_edit_username (:obj:`bool`, optional): True, if the bot can edit the username of the
            business account.
        can_change_gift_settings (:obj:`bool`, optional): True, if the bot can change the privacy
            settings pertaining to gifts for the business account.
        can_view_gifts_and_stars (:obj:`bool`, optional): True, if the bot can view gifts and the
            amount of Telegram Stars owned by the business account.
        can_convert_gifts_to_stars (:obj:`bool`, optional): True, if the bot can convert regular
            gifts owned by the business account to Telegram Stars.
        can_transfer_and_upgrade_gifts (:obj:`bool`, optional): True, if the bot can transfer and
            upgrade gifts owned by the business account.
        can_transfer_stars (:obj:`bool`, optional): True, if the bot can transfer Telegram Stars
            received by the business account to its own account, or use them to upgrade and
            transfer gifts.
        can_manage_stories (:obj:`bool`, optional): True, if the bot can post, edit and delete
            stories on behalf of the business account.

    Attributes:
        can_reply (:obj:`bool`): Optional. True, if the bot can send and edit messages in the
            private chats that had incoming messages in the last 24 hours.
        can_read_messages (:obj:`bool`): Optional. True, if the bot can mark incoming private
            messages as read.
        can_delete_sent_messages (:obj:`bool`): Optional. True, if the bot can delete messages
            sent by the bot.
        can_delete_all_messages (:obj:`bool`): Optional. True, if the bot can delete all private
            messages in managed chats.
        can_edit_name (:obj:`bool`): Optional. True, if the bot can edit the first and last name
            of the business account.
        can_edit_bio (:obj:`bool`): Optional. True, if the bot can edit the bio of the
            business account.
        can_edit_profile_photo (:obj:`bool`): Optional. True, if the bot can edit the profile
            photo of the business account.
        can_edit_username (:obj:`bool`): Optional. True, if the bot can edit the username of the
            business account.
        can_change_gift_settings (:obj:`bool`): Optional. True, if the bot can change the privacy
            settings pertaining to gifts for the business account.
        can_view_gifts_and_stars (:obj:`bool`): Optional. True, if the bot can view gifts and the
            amount of Telegram Stars owned by the business account.
        can_convert_gifts_to_stars (:obj:`bool`): Optional. True, if the bot can convert regular
            gifts owned by the business account to Telegram Stars.
        can_transfer_and_upgrade_gifts (:obj:`bool`): Optional. True, if the bot can transfer and
            upgrade gifts owned by the business account.
        can_transfer_stars (:obj:`bool`): Optional. True, if the bot can transfer Telegram Stars
            received by the business account to its own account, or use them to upgrade and
            transfer gifts.
        can_manage_stories (:obj:`bool`): Optional. True, if the bot can post, edit and delete
            stories on behalf of the business account.
    )can_change_gift_settingscan_convert_gifts_to_starscan_delete_all_messagescan_delete_sent_messagescan_edit_biocan_edit_namecan_edit_profile_photocan_edit_usernamecan_manage_storiescan_read_messages	can_replycan_transfer_and_upgrade_giftscan_transfer_starscan_view_gifts_and_starsN
api_kwargsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r!   c                   s   t  j|d || _|| _|| _|| _|| _|| _|| _|| _	|	| _
|
| _|| _|| _|| _|| _| j| j| j| j| j| j| j| j	| j
| j| j| j| j| jf| _|   d S Nr    )super__init__r   r   r   r   r   r   r   r   r   r   r   r   r   r   	_id_attrs_freeze)selfr   r   r   r   r   r   r   r   r   r   r   r   r   r   r!   	__class__ E/var/www/html/venv/lib/python3.10/site-packages/telegram/_business.pyr$      s>   zBusinessBotRights.__init__)NNNNNNNNNNNNNN)
__name__
__module____qualname____doc__	__slots__r   boolr   r$   __classcell__r*   r*   r(   r+   r   &   sd    G	
r   c                       sz   e Zd ZdZdZ	ddddeddded	ej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 )BusinessConnectiona  
    Describes the connection of the bot with a business account.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal if their :attr:`id`, :attr:`user`, :attr:`user_chat_id`, :attr:`date`,
    :attr:`rights`, and :attr:`is_enabled` are equal.

    .. versionadded:: 21.1
    .. versionchanged:: 22.1
        Equality comparison now considers :attr:`rights` instead of ``can_reply``.

    .. versionremoved:: 22.3
       Removed argument and attribute ``can_reply`` deprecated  by API 9.0.

    Args:
        id (:obj:`str`): Unique identifier of the business connection.
        user (:class:`telegram.User`): Business account user that created the business connection.
        user_chat_id (:obj:`int`): Identifier of a private chat with the user who created the
            business connection.
        date (:obj:`datetime.datetime`): Date the connection was established in Unix time.
        is_enabled (:obj:`bool`): True, if the connection is active.
        rights (:class:`BusinessBotRights`, optional): Rights of the business bot.

            .. versionadded:: 22.1

    Attributes:
        id (:obj:`str`): Unique identifier of the business connection.
        user (:class:`telegram.User`): Business account user that created the business connection.
        user_chat_id (:obj:`int`): Identifier of a private chat with the user who created the
            business connection.
        date (:obj:`datetime.datetime`): Date the connection was established in Unix time.
        is_enabled (:obj:`bool`): True, if the connection is active.
        rights (:class:`BusinessBotRights`): Optional. Rights of the business bot.

            .. versionadded:: 22.1
    )dateid
is_enabledrightsuseruser_chat_idNr    r5   r8   r	   r9   r4   r6   r7   r!   c                   s\   t  j|d || _|| _|| _|| _|| _|| _| j| j| j| j| j| jf| _| 	  d S r"   )
r#   r$   r5   r8   r9   r4   r6   r7   r%   r&   )r'   r5   r8   r9   r4   r6   r7   r!   r(   r*   r+   r$      s   	zBusinessConnection.__init__databotr   returnc                    sd   |  |}t|}t|d|d|d< t|dt||d< t|dt||d< t j||dS ),See :meth:`telegram.TelegramObject.de_json`.r4   )tzinfor8   r7   r:   r;   )	_parse_datar   r   getr
   r	   r   r#   de_json)clsr:   r;   
loc_tzinfor(   r*   r+   rB     s   
zBusinessConnection.de_jsonN)r,   r-   r.   r/   r0   strintdtmdatetimer1   r   r   r   r$   classmethodrB   r2   r*   r*   r(   r+   r3      s.    %		*r3   c                
       sh   e Zd ZdZdZdd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 )BusinessMessagesDeleteda  
    This object is received when messages are deleted from a connected business account.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal if their :attr:`business_connection_id`, :attr:`message_ids`, and
    :attr:`chat` are equal.

    .. versionadded:: 21.1

    Args:
        business_connection_id (:obj:`str`): Unique identifier of the business connection.
        chat (:class:`telegram.Chat`): Information about a chat in the business account. The bot
            may not have access to the chat or the corresponding user.
        message_ids (Sequence[:obj:`int`]): A list of identifiers of the deleted messages in the
            chat of the business account.

    Attributes:
        business_connection_id (:obj:`str`): Unique identifier of the business connection.
        chat (:class:`telegram.Chat`): Information about a chat in the business account. The bot
            may not have access to the chat or the corresponding user.
        message_ids (tuple[:obj:`int`]): A list of identifiers of the deleted messages in the
            chat of the business account.
    )business_connection_idchatmessage_idsNr    rL   rM   rN   r!   c                   sB   t  j|d || _|| _t|| _| j| j| jf| _|   d S r"   )r#   r$   rL   rM   r   rN   r%   r&   )r'   rL   rM   rN   r!   r(   r*   r+   r$   1  s   
z BusinessMessagesDeleted.__init__r:   r;   r   r<   c                    0   |  |}t|dt||d< t j||dS )r=   rM   r?   )r@   r
   rA   r   r#   rB   rC   r:   r;   r(   r*   r+   rB   F     
zBusinessMessagesDeleted.de_jsonrE   )r,   r-   r.   r/   r0   rF   r   r   rG   r   r   r$   rJ   rB   r2   r*   r*   r(   r+   rK     s    *rK   c                       sx   e Zd ZdZdZ			ddddee de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 )BusinessIntroa3  
    This object contains information about the start page settings of a Telegram Business account.

    Objects of this class are comparable in terms of equality.
    Two objects of this class are considered equal, if their
    :attr:`title`, :attr:`message` and :attr:`sticker` are equal.

    .. versionadded:: 21.1

    Args:
        title (:obj:`str`, optional): Title text of the business intro.
        message (:obj:`str`, optional): Message text of the business intro.
        sticker (:class:`telegram.Sticker`, optional): Sticker of the business intro.

    Attributes:
        title (:obj:`str`): Optional. Title text of the business intro.
        message (:obj:`str`): Optional. Message text of the business intro.
        sticker (:class:`telegram.Sticker`): Optional. Sticker of the business intro.
    )messagestickertitleNr    rU   rS   rT   r!   c                   s>   t  j|d || _|| _|| _| j| j| jf| _|   d S r"   )r#   r$   rU   rS   rT   r%   r&   )r'   rU   rS   rT   r!   r(   r*   r+   r$   k  s   zBusinessIntro.__init__r:   r;   r   r<   c                    rO   )r=   rT   r?   )r@   r
   rA   r   r#   rB   rP   r(   r*   r+   rB   |  rQ   zBusinessIntro.de_json)NNNrE   )r,   r-   r.   r/   r0   r   rF   r   r   r$   rJ   rB   r2   r*   r*   r(   r+   rR   P  s&    *rR   c                	       sh   e Zd ZdZdZ	ddd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 )BusinessLocationaD  
    This object contains information about the location of a Telegram Business account.

    Objects of this class are comparable in terms of equality.
    Two objects of this class are considered equal, if their
    :attr:`address` is equal.

    .. versionadded:: 21.1

    Args:
        address (:obj:`str`): Address of the business.
        location (:class:`telegram.Location`, optional): Location of the business.

    Attributes:
        address (:obj:`str`): Address of the business.
        location (:class:`telegram.Location`): Optional. Location of the business.
    )addresslocationNr    rW   rX   r!   c                   s0   t  j|d || _|| _| jf| _|   d S r"   )r#   r$   rW   rX   r%   r&   )r'   rW   rX   r!   r(   r*   r+   r$     s
   
zBusinessLocation.__init__r:   r;   r   r<   c                    rO   )r=   rX   r?   )r@   r
   rA   r   r#   rB   rP   r(   r*   r+   rB     rQ   zBusinessLocation.de_jsonrE   )r,   r-   r.   r/   r0   rF   r   r   r   r$   rJ   rB   r2   r*   r*   r(   r+   rV     s    *rV   c                       s   e Zd ZdZdZdddededee f fdd	Zd
ede	eeef fddZ
ede	eeef fddZede	eeef fddZ  ZS )BusinessOpeningHoursIntervala  
    This object describes an interval of time during which a business is open.

    Objects of this class are comparable in terms of equality.
    Two objects of this class are considered equal, if their
    :attr:`opening_minute` and :attr:`closing_minute` are equal.

    .. versionadded:: 21.1

    Examples:
        A day has (24 * 60 =) 1440 minutes, a week has (7 * 1440 =) 10080 minutes.
        Starting the the minute's sequence from Monday, example values of
        :attr:`opening_minute`, :attr:`closing_minute` will map to the following day times:

        * Monday - 8am to 8:30pm:
            - ``opening_minute = 480`` :guilabel:`8 * 60`
            - ``closing_minute = 1230`` :guilabel:`20 * 60 + 30`
        * Tuesday - 24 hours:
            - ``opening_minute = 1440`` :guilabel:`24 * 60`
            - ``closing_minute = 2879`` :guilabel:`2 * 24 * 60 - 1`
        * Sunday - 12am - 11:58pm:
            - ``opening_minute = 8640`` :guilabel:`6 * 24 * 60`
            - ``closing_minute = 10078`` :guilabel:`7 * 24 * 60 - 2`

    Args:
        opening_minute (:obj:`int`): The minute's sequence number in a week, starting on Monday,
            marking the start of the time interval during which the business is open;
            0 - 7 * 24 * 60.
        closing_minute (:obj:`int`): The minute's
            sequence number in a week, starting on Monday, marking the end of the time interval
            during which the business is open; 0 - 8 * 24 * 60

    Attributes:
        opening_minute (:obj:`int`): The minute's sequence number in a week, starting on Monday,
            marking the start of the time interval during which the business is open;
            0 - 7 * 24 * 60.
        closing_minute (:obj:`int`): The minute's
            sequence number in a week, starting on Monday, marking the end of the time interval
            during which the business is open; 0 - 8 * 24 * 60
    )_closing_time_opening_timeclosing_minuteopening_minuteNr    r]   r\   r!   c                   s@   t  j|d || _|| _d | _d | _| j| jf| _|   d S r"   )r#   r$   r]   r\   r[   rZ   r%   r&   )r'   r]   r\   r!   r(   r*   r+   r$     s   z%BusinessOpeningHoursInterval.__init__minuter<   c                 C   s   |d |d d |d d fS )Ni  <   r*   )r'   r^   r*   r*   r+   _parse_minute  s   z*BusinessOpeningHoursInterval._parse_minutec                 C      | j du r| | j| _ | j S )aW  Convenience attribute. A :obj:`tuple` parsed from :attr:`opening_minute`. It contains
        the `weekday`, `hour` and `minute` in the same ranges as :attr:`datetime.datetime.weekday`,
        :attr:`datetime.datetime.hour` and :attr:`datetime.datetime.minute`

        Returns:
            tuple[:obj:`int`, :obj:`int`, :obj:`int`]:
        N)r[   r`   r]   r'   r*   r*   r+   opening_time     
	z)BusinessOpeningHoursInterval.opening_timec                 C   ra   )aW  Convenience attribute. A :obj:`tuple` parsed from :attr:`closing_minute`. It contains
        the `weekday`, `hour` and `minute` in the same ranges as :attr:`datetime.datetime.weekday`,
        :attr:`datetime.datetime.hour` and :attr:`datetime.datetime.minute`

        Returns:
            tuple[:obj:`int`, :obj:`int`, :obj:`int`]:
        N)rZ   r`   r\   rb   r*   r*   r+   closing_time  rd   z)BusinessOpeningHoursInterval.closing_time)r,   r-   r.   r/   r0   rG   r   r   r$   tupler`   propertyrc   re   r2   r*   r*   r(   r+   rY     s     )"rY   c                       sd   e Zd ZdZdZdd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 )BusinessOpeningHoursaS  
    This object describes the opening hours of a business.

    Objects of this class are comparable in terms of equality.
    Two objects of this class are considered equal, if their
    :attr:`time_zone_name` and :attr:`opening_hours` are equal.

    .. versionadded:: 21.1

    Args:
        time_zone_name (:obj:`str`): Unique name of the time zone for which the opening
            hours are defined.
        opening_hours (Sequence[:class:`telegram.BusinessOpeningHoursInterval`]): List of
            time intervals describing business opening hours.

    Attributes:
        time_zone_name (:obj:`str`): Unique name of the time zone for which the opening
            hours are defined.
        opening_hours (Sequence[:class:`telegram.BusinessOpeningHoursInterval`]): List of
            time intervals describing business opening hours.
    )opening_hourstime_zone_nameNr    rj   ri   r!   c                   s8   t  j|d || _t|| _| j| jf| _|   d S r"   )r#   r$   rj   r   ri   r%   r&   )r'   rj   ri   r!   r(   r*   r+   r$   ,  s   zBusinessOpeningHours.__init__r:   r;   r   r<   c                    rO   )r=   ri   r?   )r@   r   rA   rY   r#   rB   rP   r(   r*   r+   rB   =  s
   
zBusinessOpeningHours.de_jsonrE   )r,   r-   r.   r/   r0   rF   r   rY   r   r   r$   rJ   rB   r2   r*   r*   r(   r+   rh     s    *rh   )$r/   rI   rH   collections.abcr   typingr   r   telegram._chatr   telegram._files.locationr   telegram._files.stickerr   telegram._telegramobjectr   telegram._userr	   telegram._utils.argumentparsingr
   r   r   telegram._utils.datetimer   r   telegram._utils.typesr   telegramr   r   r3   rK   rR   rV   rY   rh   r*   r*   r*   r+   <module>   s,    \>61\