o
    ZzjÃ=  ã                   @   sà   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 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G dd„ deƒZG dd„ deƒZdS )z8This module contains objects that represent story areas.é    )ÚFinal)Ú	constants)ÚReactionType)ÚTelegramObject)Úenum)ÚJSONDictc                       sP   e Zd ZdZdZddœdedededed	ed
ededB ddf‡ fdd„Z‡  ZS )ÚStoryAreaPositiona|  Describes the position of a clickable area within a story.

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

    .. versionadded:: 22.1

    Args:
        x_percentage (:obj:`float`): The abscissa of the area's center, as a percentage of the
            media width.
        y_percentage (:obj:`float`): The ordinate of the area's center, as a percentage of the
            media height.
        width_percentage (:obj:`float`): The width of the area's rectangle, as a percentage of the
            media width.
        height_percentage (:obj:`float`): The height of the area's rectangle, as a percentage of
            the media height.
        rotation_angle (:obj:`float`): The clockwise rotation angle of the rectangle, in degrees;
            0-:tg-const:`~telegram.constants.StoryAreaPositionLimit.MAX_ROTATION_ANGLE`.
        corner_radius_percentage (:obj:`float`): The radius of the rectangle corner rounding, as a
            percentage of the media width.

    Attributes:
        x_percentage (:obj:`float`): The abscissa of the area's center, as a percentage of the
            media width.
        y_percentage (:obj:`float`): The ordinate of the area's center, as a percentage of the
            media height.
        width_percentage (:obj:`float`): The width of the area's rectangle, as a percentage of the
            media width.
        height_percentage (:obj:`float`): The height of the area's rectangle, as a percentage of
            the media height.
        rotation_angle (:obj:`float`): The clockwise rotation angle of the rectangle, in degrees;
            0-:tg-const:`~telegram.constants.StoryAreaPositionLimit.MAX_ROTATION_ANGLE`.
        corner_radius_percentage (:obj:`float`): The radius of the rectangle corner rounding, as a
            percentage of the media width.

    )Úcorner_radius_percentageÚheight_percentageÚrotation_angleÚwidth_percentageÚx_percentageÚy_percentageN©Ú
api_kwargsr   r   r   r
   r   r	   r   Úreturnc                   s\   t ƒ j|d� || _|| _|| _|| _|| _|| _| j| j| j| j| j| jf| _|  	¡  d S ©Nr   )
ÚsuperÚ__init__r   r   r   r
   r   r	   Ú	_id_attrsÚ_freeze)Úselfr   r   r   r
   r   r	   r   ©Ú	__class__© úN/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telegram/_storyarea.pyr   M   s   úzStoryAreaPosition.__init__)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__Úfloatr   r   Ú__classcell__r   r   r   r   r      s*    %÷þýüûúù	÷
ör   c                       s\   e Zd ZdZdZ			dddœdededB dedB dedB d	edB d
df‡ fdd„Z‡  ZS )ÚLocationAddressaÚ  Describes the physical address of a location.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`country_code`, :attr:`state`, :attr:`city` and :attr:`street`
    are equal.

    .. versionadded:: 22.1

    Args:
        country_code (:obj:`str`): The two-letter ``ISO 3166-1 alpha-2`` country code of the
            country where the location is located.
        state (:obj:`str`, optional): State of the location.
        city (:obj:`str`, optional): City of the location.
        street (:obj:`str`, optional): Street address of the location.

    Attributes:
        country_code (:obj:`str`): The two-letter ``ISO 3166-1 alpha-2`` country code of the
            country where the location is located.
        state (:obj:`str`): Optional. State of the location.
        city (:obj:`str`): Optional. City of the location.
        street (:obj:`str`): Optional. Street address of the location.

    )ÚcityÚcountry_codeÚstateÚstreetNr   r%   r&   r$   r'   r   r   c                   sH   t ƒ j|d� || _|| _|| _|| _| j| j| j| jf| _|  ¡  d S r   )r   r   r%   r&   r$   r'   r   r   )r   r%   r&   r$   r'   r   r   r   r   r   †   s   	zLocationAddress.__init__)NNN©	r   r   r   r   r    Ústrr   r   r"   r   r   r   r   r#   k   s*    ûùþýüûùør#   c                       s¬   e Zd ZU dZdZejjZee	 e
d< 	 ejjZee	 e
d< 	 ejjZee	 e
d< 	 ejjZee	 e
d< 	 ejjZee	 e
d< 	 dd	œd
e	dedB ddf‡ fdd„Z‡  ZS )ÚStoryAreaTypeah  Describes the type of a clickable area on a story. Currently, it can be one of:

    * :class:`telegram.StoryAreaTypeLocation`
    * :class:`telegram.StoryAreaTypeSuggestedReaction`
    * :class:`telegram.StoryAreaTypeLink`
    * :class:`telegram.StoryAreaTypeWeather`
    * :class:`telegram.StoryAreaTypeUniqueGift`

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

    .. versionadded:: 22.1

    Args:
        type (:obj:`str`): Type of the area.

    Attributes:
        type (:obj:`str`): Type of the area.

    )ÚtypeÚLOCATIONÚSUGGESTED_REACTIONÚLINKÚWEATHERÚUNIQUE_GIFTNr   r+   r   r   c                   s6   t ƒ j|d� t tj||¡| _| jf| _|  ¡  d S r   )	r   r   r   Ú
get_memberr   ÚStoryAreaTypeTyper+   r   r   )r   r+   r   r   r   r   r   ¼   s   
zStoryAreaType.__init__)r   r   r   r   r    r   r2   r,   r   r)   Ú__annotations__r-   r.   r/   r0   r   r   r"   r   r   r   r   r*   ™   s*   
 üþüûr*   c                       sL   e Zd ZdZdZ	dddœdedededB dedB d	df
‡ fd
d„Z‡  Z	S )ÚStoryAreaTypeLocationa¥  Describes a story area pointing to a location. Currently, a story can have up to
    :tg-const:`~telegram.constants.StoryAreaTypeLimit.MAX_LOCATION_AREAS` location areas.

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

    .. versionadded:: 22.1

    Args:
        latitude (:obj:`float`): Location latitude in degrees.
        longitude (:obj:`float`): Location longitude in degrees.
        address (:class:`telegram.LocationAddress`, optional): Address of the location.

    Attributes:
        type (:obj:`str`): Type of the area, always :attr:`~telegram.StoryAreaType.LOCATION`.
        latitude (:obj:`float`): Location latitude in degrees.
        longitude (:obj:`float`): Location longitude in degrees.
        address (:class:`telegram.LocationAddress`): Optional. Address of the location.

    )ÚaddressÚlatitudeÚ	longitudeNr   r6   r7   r5   r   r   c                   sd   t ƒ jtj|d� |  ¡ � || _|| _|| _| j| j| jf| _	W d   ƒ d S 1 s+w   Y  d S ©N)r+   r   )
r   r   r*   r,   Ú	_unfrozenr6   r7   r5   r+   r   )r   r6   r7   r5   r   r   r   r   r   á   s   
"ûzStoryAreaTypeLocation.__init__)N)
r   r   r   r   r    r!   r#   r   r   r"   r   r   r   r   r4   É   s"    üúþýüúùr4   c                       sR   e Zd ZdZdZ		dddœdededB dedB dedB d	df
‡ fd
d„Z‡  Z	S )ÚStoryAreaTypeSuggestedReactiona�  
    Describes a story area pointing to a suggested reaction. Currently, a story can have up to
    :tg-const:`~telegram.constants.StoryAreaTypeLimit.MAX_SUGGESTED_REACTION_AREAS`
    suggested reaction areas.

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

    .. versionadded:: 22.1

    Args:
        reaction_type (:class:`ReactionType`): Type of the reaction.
        is_dark (:obj:`bool`, optional): Pass :obj:`True` if the reaction area has a dark
            background.
        is_flipped (:obj:`bool`, optional): Pass :obj:`True` if reaction area corner is flipped.

    Attributes:
        type (:obj:`str`): Type of the area, always
            :tg-const:`~telegram.StoryAreaType.SUGGESTED_REACTION`.
        reaction_type (:class:`ReactionType`): Type of the reaction.
        is_dark (:obj:`bool`): Optional. Pass :obj:`True` if the reaction area has a dark
            background.
        is_flipped (:obj:`bool`): Optional. Pass :obj:`True` if reaction area corner is flipped.

    )Úis_darkÚ
is_flippedÚreaction_typeNr   r=   r;   r<   r   r   c                   óh   t ƒ jtj|d� |  ¡ � || _|| _|| _| j| j| j| jf| _	W d   ƒ d S 1 s-w   Y  d S r8   )
r   r   r*   r-   r9   r=   r;   r<   r+   r   )r   r=   r;   r<   r   r   r   r   r     ó   
"ûz'StoryAreaTypeSuggestedReaction.__init__)NN)
r   r   r   r   r    r   Úboolr   r   r"   r   r   r   r   r:   ó   s$    üúþýüúùr:   c                       ó<   e Zd ZdZdZddœdededB ddf‡ fdd	„Z‡  ZS )
ÚStoryAreaTypeLinka–  Describes a story area pointing to an ``HTTP`` or ``tg://`` link. Currently, a story can
    have up to :tg-const:`~telegram.constants.StoryAreaTypeLimit.MAX_LINK_AREAS` link areas.

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

    .. versionadded:: 22.1

    Args:
        url (:obj:`str`): ``HTTP`` or ``tg://`` URL to be opened when the area is clicked.

    Attributes:
        type (:obj:`str`): Type of the area, always :attr:`~telegram.StoryAreaType.LINK`.
        url (:obj:`str`): ``HTTP`` or ``tg://`` URL to be opened when the area is clicked.

    )ÚurlNr   rC   r   r   c                   óT   t ƒ jtj|d� |  ¡ � || _| j| jf| _W d   ƒ d S 1 s#w   Y  d S r8   )r   r   r*   r.   r9   rC   r+   r   )r   rC   r   r   r   r   r   7  ó
   
"ýzStoryAreaTypeLink.__init__r(   r   r   r   r   rB   #  s    üþüûrB   c                       sD   e Zd ZdZdZddœdededededB d	df
‡ fd
d„Z	‡  Z
S )ÚStoryAreaTypeWeatheraè  
    Describes a story area containing weather information. Currently, a story can have up to
    :tg-const:`~telegram.constants.StoryAreaTypeLimit.MAX_WEATHER_AREAS` weather areas.

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

    .. versionadded:: 22.1

    Args:
        temperature (:obj:`float`): Temperature, in degree Celsius.
        emoji (:obj:`str`): Emoji representing the weather.
        background_color (:obj:`int`): A color of the area background in the ``ARGB`` format.

    Attributes:
        type (:obj:`str`): Type of the area, always
            :tg-const:`~telegram.StoryAreaType.WEATHER`.
        temperature (:obj:`float`): Temperature, in degree Celsius.
        emoji (:obj:`str`): Emoji representing the weather.
        background_color (:obj:`int`): A color of the area background in the ``ARGB`` format.

    )Úbackground_colorÚemojiÚtemperatureNr   rI   rH   rG   r   r   c                   r>   r8   )
r   r   r*   r/   r9   rI   rH   rG   r+   r   )r   rI   rH   rG   r   r   r   r   r   `  r?   zStoryAreaTypeWeather.__init__)r   r   r   r   r    r!   r)   Úintr   r   r"   r   r   r   r   rF   E  s    úþýüúùrF   c                       rA   )
ÚStoryAreaTypeUniqueGiftad  
    Describes a story area pointing to a unique gift. Currently, a story can have at most
    :tg-const:`~telegram.constants.StoryAreaTypeLimit.MAX_UNIQUE_GIFT_AREAS` unique gift area.

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

    .. versionadded:: 22.1

    Args:
        name (:obj:`str`): Unique name of the gift.

    Attributes:
        type (:obj:`str`): Type of the area, always
            :tg-const:`~telegram.StoryAreaType.UNIQUE_GIFT`.
        name (:obj:`str`): Unique name of the gift.

    )ÚnameNr   rL   r   r   c                   rD   r8   )r   r   r*   r0   r9   rL   r+   r   )r   rL   r   r   r   r   r   ˆ  rE   z StoryAreaTypeUniqueGift.__init__r(   r   r   r   r   rK   r  s    üþüûrK   c                	       s@   e Zd ZdZdZddœdedededB ddf‡ fd	d
„Z‡  Z	S )Ú	StoryAreaa4  Describes a clickable area on a story media.

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

    .. versionadded:: 22.1

    Args:
        position (:class:`telegram.StoryAreaPosition`): Position of the area.
        type (:class:`telegram.StoryAreaType`): Type of the area.

    Attributes:
        position (:class:`telegram.StoryAreaPosition`): Position of the area.
        type (:class:`telegram.StoryAreaType`): Type of the area.

    )Úpositionr+   Nr   rN   r+   r   r   c                   s4   t ƒ j|d� || _|| _| j| jf| _|  ¡  d S r   )r   r   rN   r+   r   r   )r   rN   r+   r   r   r   r   r   ª  s
   zStoryArea.__init__)
r   r   r   r   r    r   r*   r   r   r"   r   r   r   r   rM   –  s    ûþýûúrM   N)r   Útypingr   Útelegramr   Útelegram._reactionr   Útelegram._telegramobjectr   Útelegram._utilsr   Útelegram._utils.typesr   r   r#   r*   r4   r:   rB   rF   rK   rM   r   r   r   r   Ú<module>   s    M.0*0"-$