o
    Zzjç  ã                   @   s¤   d Z ddl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 dd	lmZ dd
lmZmZ G dd„ de
ƒZG dd„ deƒZG dd„ deƒZdS )zCThis module contains objects that represent paid media in Telegram.é    N)ÚFinal)Ú	constants)Ú	InputFile)ÚTelegramObject)Úenum)Úto_timedelta©Úparse_file_input)Ú	FileInputÚJSONDictc                       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< 	 ddœde	dedB d	df‡ fd
d„Zeded	e	eB fdd„ƒZ‡  ZS )ÚInputStoryContentaN  This object describes the content of a story to post. Currently, it can be one of:

    * :class:`telegram.InputStoryContentPhoto`
    * :class:`telegram.InputStoryContentVideo`

    .. versionadded:: 22.1

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

    Attributes:
        type (:obj:`str`): Type of the content.
    )ÚtypeÚPHOTOÚVIDEON©Ú
api_kwargsr   r   Úreturnc                   s,   t ƒ j|d� t tj||¡| _|  ¡  d S )Nr   )ÚsuperÚ__init__r   Ú
get_memberr   ÚInputStoryContentTyper   Ú_freeze)Úselfr   r   ©Ú	__class__© ú\/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telegram/_files/inputstorycontent.pyr   7   s   zInputStoryContent.__init__Ú
file_inputc                 C   s   t | ddd�S )NT)ÚattachÚ
local_moder   )r   r   r   r   Ú_parse_file_inputB   s   z#InputStoryContent._parse_file_input)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r   r   ÚstrÚ__annotations__r   r   r   Ústaticmethodr
   r   r    Ú__classcell__r   r   r   r   r   !   s"   
 üþüû r   c                       s<   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 )
ÚInputStoryContentPhotoa  Describes a photo to post as a story.

    .. versionadded:: 22.1

    Args:
        photo (:term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | :obj:`str`,             optional): The photo to post as a story. The photo must be of the
            size :tg-const:`telegram.constants.InputStoryContentLimit.PHOTO_WIDTH`
            x :tg-const:`telegram.constants.InputStoryContentLimit.PHOTO_HEIGHT` and must not
            exceed :tg-const:`telegram.constants.InputStoryContentLimit.PHOTOSIZE_UPLOAD` MB.
            |uploadinputnopath|.

    Attributes:
        type (:obj:`str`): Type of the content, must be :attr:`~telegram.InputStoryContent.PHOTO`.
        photo (:class:`telegram.InputFile`): The photo to post as a story. The photo must be of the
            size :tg-const:`telegram.constants.InputStoryContentLimit.PHOTO_WIDTH`
            x :tg-const:`telegram.constants.InputStoryContentLimit.PHOTO_HEIGHT` and must not
            exceed :tg-const:`telegram.constants.InputStoryContentLimit.PHOTOSIZE_UPLOAD` MB.

    )ÚphotoNr   r+   r   r   c                   sL   t ƒ jtj|d� |  ¡ � |  |¡| _W d   ƒ d S 1 sw   Y  d S ©N)r   r   )r   r   r   r   Ú	_unfrozenr    r+   )r   r+   r   r   r   r   r   a   s   
"ÿzInputStoryContentPhoto.__init__)	r!   r"   r#   r$   r%   r
   r   r   r)   r   r   r   r   r*   I   s    üþüûr*   c                       sh   e Zd ZdZdZ			dddœdedeejB dB deejB dB de	dB d	e
dB d
df‡ fdd„Z‡  ZS )ÚInputStoryContentVideoa	  
    Describes a video to post as a story.

    .. versionadded:: 22.1

    Args:
        video (:term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | :obj:`str`,             optional): The video to post as a story. The video must be of
            the size :tg-const:`telegram.constants.InputStoryContentLimit.VIDEO_WIDTH`
            x :tg-const:`telegram.constants.InputStoryContentLimit.VIDEO_HEIGHT`,
            streamable, encoded with ``H.265`` codec, with key frames added
            each second in the ``MPEG4`` format, and must not exceed
            :tg-const:`telegram.constants.InputStoryContentLimit.VIDEOSIZE_UPLOAD` MB.
            |uploadinputnopath|.
        duration (:class:`datetime.timedelta` | :obj:`int` | :obj:`float`, optional): Precise
            duration of the video in seconds;
            0-:tg-const:`telegram.constants.InputStoryContentLimit.MAX_VIDEO_DURATION`
        cover_frame_timestamp (:class:`datetime.timedelta` | :obj:`int` | :obj:`float`, optional):
            Timestamp in seconds of the frame that will be used as the static cover for the story.
            Defaults to ``0.0``.
        is_animation (:obj:`bool`, optional): Pass :obj:`True` if the video has no sound

    Attributes:
        type (:obj:`str`): Type of the content, must be :attr:`~telegram.InputStoryContent.VIDEO`.
        video (:class:`telegram.InputFile`): The video to post as a story. The video must be of
            the size :tg-const:`telegram.constants.InputStoryContentLimit.VIDEO_WIDTH`
            x :tg-const:`telegram.constants.InputStoryContentLimit.VIDEO_HEIGHT`,
            streamable, encoded with ``H.265`` codec, with key frames added
            each second in the ``MPEG4`` format, and must not exceed
            :tg-const:`telegram.constants.InputStoryContentLimit.VIDEOSIZE_UPLOAD` MB.
        duration (:class:`datetime.timedelta`): Optional. Precise duration of the video in seconds;
            0-:tg-const:`telegram.constants.InputStoryContentLimit.MAX_VIDEO_DURATION`
        cover_frame_timestamp (:class:`datetime.timedelta`): Optional. Timestamp in seconds of the
            frame that will be used as the static cover for the story. Defaults to ``0.0``.
        is_animation (:obj:`bool`): Optional. Pass :obj:`True` if the video has no sound
    )Úcover_frame_timestampÚdurationÚis_animationÚvideoNr   r2   r0   r/   r1   r   r   c                   sf   t ƒ jtj|d� |  ¡ � |  |¡| _t|ƒ| _t|ƒ| _	|| _
W d   ƒ d S 1 s,w   Y  d S r,   )r   r   r   r   r-   r    r2   r   r0   r/   r1   )r   r2   r0   r/   r1   r   r   r   r   r   •   s   	


"üzInputStoryContentVideo.__init__)NNN)r!   r"   r#   r$   r%   r
   ÚfloatÚdtmÚ	timedeltaÚboolr   r   r)   r   r   r   r   r.   m   s*    %ûùþýüûùør.   )r$   Údatetimer4   Útypingr   Útelegramr   Útelegram._files.inputfiler   Útelegram._telegramobjectr   Útelegram._utilsr   Útelegram._utils.argumentparsingr   Útelegram._utils.filesr	   Útelegram._utils.typesr
   r   r   r*   r.   r   r   r   r   Ú<module>   s   ($