o
    "hO                     @   s   d Z ddlZddlmZ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 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OptionalUnion)	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e d	df fd
dZeded	ee	ef 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__ U/var/www/html/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   r   staticmethodr   r   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e 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   r,   I   s    r,   c                       sp   e Zd ZdZdZ			ddddedeeee	j
f  deeee	j
f  dee d	ee 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   r4   r2   r1   r3   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"   r4   r	   r2   r1   r3   )r   r4   r2   r1   r3   r   r   r   r   r      s   	

"zInputStoryContentVideo.__init__)NNN)r#   r$   r%   r&   r'   r   r   r   floatdtm	timedeltaboolr   r   r+   r   r   r   r   r0   m   s*    %r0   )r&   datetimer6   typingr   r   r   telegramr   telegram._files.inputfiler   telegram._telegramobjectr   telegram._utilsr   telegram._utils.argumentparsingr	   telegram._utils.filesr   telegram._utils.typesr   r   r   r,   r0   r   r   r   r   <module>   s   ($