o
    f>h                     @   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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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   6   s   zInputStoryContent.__init__
file_inputc                 C   s   t | dddS )NT)attach
local_moder	   )r   r   r   r   _parse_file_inputA   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   `   s   
"zInputStoryContentPhoto.__init__)
r"   r#   r$   r%   r&   r   r   r   r   r*   r   r   r   r   r+   H   s    r+   c                       s   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edeeee	j
f  d
ee	j
 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   r3   r1   r0   r2   r   r   c                   sj   t  jtj|d |   | || _| || _| || _	|| _
W d    d S 1 s.w   Y  d S r-   )r   r   r   r   r.   r!   r3   _parse_period_argr1   r0   r2   )r   r3   r1   r0   r2   r   r   r   r   r      s   	
"zInputStoryContentVideo.__init__argc                 C   s(   | d u rd S t | tjr| S tj| dS )N)seconds)
isinstancedtm	timedelta)r5   r   r   r   r4      s
   z(InputStoryContentVideo._parse_period_arg)NNN)r"   r#   r$   r%   r&   r   r   r   floatr8   r9   boolr   r   r)   r4   r*   r   r   r   r   r/   l   s.    %0r/   )r%   datetimer8   typingr   r   r   telegramr   telegram._files.inputfiler   telegram._telegramobjectr   telegram._utilsr   telegram._utils.filesr
   telegram._utils.typesr   r   r   r+   r/   r   r   r   r   <module>   s   ($