o
    N,hh[                     @   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 ddlmZ erJd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 dS )zAThis module contains objects related to Telegram suggested posts.    N)TYPE_CHECKINGFinalOptional)	constants)Message)
StarAmount)TelegramObject)enum)de_json_optional)extract_tzinfo_from_defaultsfrom_timestamp)JSONDict)Botc                       s<   e Zd ZdZdZdddededee f fdd	Z	  Z
S )
SuggestedPostPriceuI  
    Desribes the price of a suggested post.

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

    .. versionadded:: 22.4

    Args:
        currency (:obj:`str`):
            Currency in which the post will be paid. Currently, must be one of ``“XTR”`` for
            Telegram Stars or ``“TON”`` for toncoins.
        amount (:obj:`int`):
            The amount of the currency that will be paid for the post in the smallest units of the
            currency, i.e. Telegram Stars or nanotoncoins. Currently, price in Telegram Stars must
            be between :tg-const:`telegram.constants.SuggestedPost.MIN_PRICE_STARS`
            and :tg-const:`telegram.constants.SuggestedPost.MAX_PRICE_STARS`, and price in
            nanotoncoins must be between
            :tg-const:`telegram.constants.SuggestedPost.MIN_PRICE_NANOTONCOINS`
            and :tg-const:`telegram.constants.SuggestedPost.MAX_PRICE_NANOTONCOINS`.

    Attributes:
        currency (:obj:`str`):
            Currency in which the post will be paid. Currently, must be one of ``“XTR”`` for
            Telegram Stars or ``“TON”`` for toncoins.
        amount (:obj:`int`):
            The amount of the currency that will be paid for the post in the smallest units of the
            currency, i.e. Telegram Stars or nanotoncoins. Currently, price in Telegram Stars must
            be between :tg-const:`telegram.constants.SuggestedPost.MIN_PRICE_STARS`
            and :tg-const:`telegram.constants.SuggestedPost.MAX_PRICE_STARS`, and price in
            nanotoncoins must be between
            :tg-const:`telegram.constants.SuggestedPost.MIN_PRICE_NANOTONCOINS`
            and :tg-const:`telegram.constants.SuggestedPost.MAX_PRICE_NANOTONCOINS`.
    )amountcurrencyN
api_kwargsr   r   r   c                   4   t  j|d || _|| _| j| jf| _|   d S Nr   )super__init__r   r   	_id_attrs_freeze)selfr   r   r   	__class__ c/var/www/www-root/data/www/bot.pdev.uz/venv/lib/python3.10/site-packages/telegram/_suggestedpost.pyr   K   
   zSuggestedPostPrice.__init__)__name__
__module____qualname____doc__	__slots__strintr   r   r   __classcell__r   r   r   r   r   %   s    #r   c                	       sp   e Zd ZdZdZ		ddddee deej dee	 f fdd	Z
edd
e	ded dd f fddZ  ZS )SuggestedPostParametersa2  
    Contains parameters of a post that is being suggested by the bot.

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

    .. versionadded:: 22.4

    Args:
        price (:class:`telegram.SuggestedPostPrice`, optional):
            Proposed price for the post. If the field is omitted, then the post is unpaid.
        send_date (:class:`datetime.datetime`, optional):
            Proposed send date of the post. If specified, then the date
            must be between :tg-const:`telegram.constants.SuggestedPost.MIN_SEND_DATE`
            second and :tg-const:`telegram.constants.SuggestedPost.MAX_SEND_DATE` seconds (30 days)
            in the future. If the field is omitted, then the post can be published at any time
            within :tg-const:`telegram.constants.SuggestedPost.MAX_SEND_DATE` seconds (30 days) at
            the sole discretion of the user who approves it.
            |datetime_localization|

    Attributes:
        price (:class:`telegram.SuggestedPostPrice`):
            Optional. Proposed price for the post. If the field is omitted, then the post
            is unpaid.
        send_date (:class:`datetime.datetime`):
            Optional. Proposed send date of the post. If specified, then the date
            must be between :tg-const:`telegram.constants.SuggestedPost.MIN_SEND_DATE`
            second and :tg-const:`telegram.constants.SuggestedPost.MAX_SEND_DATE` seconds (30 days)
            in the future. If the field is omitted, then the post can be published at any time
            within :tg-const:`telegram.constants.SuggestedPost.MAX_SEND_DATE` seconds (30 days) at
            the sole discretion of the user who approves it.
            |datetime_localization|

    )price	send_dateNr   r)   r*   r   c                   r   r   )r   r   r)   r*   r   r   )r   r)   r*   r   r   r   r   r      r   z SuggestedPostParameters.__init__databotr   returnc                    sN   |  |}t|dt||d< t|}t|d|d|d< t j||dS ,See :meth:`telegram.TelegramObject.de_json`.r)   r*   tzinfor+   r,   )_parse_datar
   getr   r   r   r   de_jsonclsr+   r,   
loc_tzinfor   r   r   r5      s
   
zSuggestedPostParameters.de_jsonNNN)r    r!   r"   r#   r$   r   r   dtmdatetimer   r   classmethodr5   r'   r   r   r   r   r(   [   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< 	 		dddde	d	ee d
eej dee f fddZeddeded dd f fddZ  ZS )SuggestedPostInfoa7  
    Contains information about a suggested post.

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

    .. versionadded:: 22.4

    Args:
        state (:obj:`str`):
            State of the suggested post. Currently, it can be one of
            :tg-const:`~telegram.constants.SuggestedPostInfoState.PENDING`,
            :tg-const:`~telegram.constants.SuggestedPostInfoState.APPROVED`,
            :tg-const:`~telegram.constants.SuggestedPostInfoState.DECLINED`.
        price (:obj:`SuggestedPostPrice`, optional):
            Proposed price of the post. If the field is omitted, then the post is unpaid.
        send_date (:class:`datetime.datetime`, optional):
            Proposed send date of the post. If the field is omitted, then the post can be published
            at any time within 30 days at the sole discretion of the user or administrator who
            approves it.
            |datetime_localization|

    Attributes:
        state (:obj:`str`):
            State of the suggested post. Currently, it can be one of
            :tg-const:`~telegram.constants.SuggestedPostInfoState.PENDING`,
            :tg-const:`~telegram.constants.SuggestedPostInfoState.APPROVED`,
            :tg-const:`~telegram.constants.SuggestedPostInfoState.DECLINED`.
        price (:obj:`SuggestedPostPrice`):
            Optional. Proposed price of the post. If the field is omitted, then the post is unpaid.
        send_date (:class:`datetime.datetime`):
            Optional. Proposed send date of the post. If the field is omitted, then the post can be
            published at any time within 30 days at the sole discretion of the user or
            administrator who approves it.
            |datetime_localization|

    )r)   r*   statePENDINGAPPROVEDDECLINEDNr   r?   r)   r*   r   c                   sF   t  j|d ttj||| _|| _|| _| j| jf| _	| 
  d S r   )r   r   r	   
get_memberr   SuggestedPostInfoStater?   r)   r*   r   r   )r   r?   r)   r*   r   r   r   r   r      s   zSuggestedPostInfo.__init__r+   r,   r   r-   c                    sN   |  |}t|}t|dt||d< t|d|d|d< t j||dS r.   )r3   r   r
   r4   r   r   r   r5   r6   r   r   r   r5      s
   
zSuggestedPostInfo.de_jsonr9   r:   )r    r!   r"   r#   r$   r   rD   r@   r   r%   __annotations__rA   rB   r   r   r;   r<   r   r   r=   r5   r'   r   r   r   r   r>      s0   
 &*r>   c                	       sn   e Zd ZdZdZ		ddd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 )SuggestedPostDeclinedad  
    Describes a service message about the rejection of a suggested post.

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

    .. versionadded:: 22.4

    Args:
        suggested_post_message (:class:`telegram.Message`, optional):
            Message containing the suggested post. Note that the :class:`~telegram.Message` object
            in this field will not contain the :attr:`~telegram.Message.reply_to_message` field
            even if it itself is a reply.
        comment (:obj:`str`, optional):
            Comment with which the post was declined.

    Attributes:
        suggested_post_message (:class:`telegram.Message`):
            Optional. Message containing the suggested post. Note that the
            :class:`~telegram.Message` object in this field will not contain
            the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply.
        comment (:obj:`str`):
            Optional. Comment with which the post was declined.

    )commentsuggested_post_messageNr   rH   rG   r   c                   r   r   )r   r   rH   rG   r   r   )r   rH   rG   r   r   r   r   r     r   zSuggestedPostDeclined.__init__r+   r,   r   r-   c                    0   |  |}t|dt||d< t j||dS r/   rH   r2   r3   r
   r4   r   r   r5   r7   r+   r,   r   r   r   r5     
   
zSuggestedPostDeclined.de_jsonr9   r:   )r    r!   r"   r#   r$   r   r   r%   r   r   r=   r5   r'   r   r   r   r   rF      s     *rF   c                       s|   e Zd ZdZdZ			dddde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 )SuggestedPostPaidu  
    Describes a service message about a successful payment for a suggested post.

    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.4

    Args:
        suggested_post_message (:class:`telegram.Message`, optional):
            Message containing the suggested post. Note that the :class:`~telegram.Message` object
            in this field will not contain the :attr:`~telegram.Message.reply_to_message` field
            even if it itself is a reply.
        currency (:obj:`str`):
            Currency in which the payment was made. Currently, one of ``“XTR”`` for Telegram Stars
            or ``“TON”`` for toncoins.
        amount (:obj:`int`, optional):
            The amount of the currency that was received by the channel in nanotoncoins; for
            payments in toncoins only.
        star_amount (:class:`telegram.StarAmount`, optional):
            The amount of Telegram Stars that was received by the channel; for payments in Telegram
            Stars only.


    Attributes:
        suggested_post_message (:class:`telegram.Message`):
            Optional. Message containing the suggested post. Note that the
            :class:`~telegram.Message` object in this field will not contain
            the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply.
        currency (:obj:`str`):
            Currency in which the payment was made. Currently, one of ``“XTR”`` for Telegram Stars
            or ``“TON”`` for toncoins.
        amount (:obj:`int`):
            Optional. The amount of the currency that was received by the channel in nanotoncoins;
            for payments in toncoins only.
        star_amount (:class:`telegram.StarAmount`):
            Optional. The amount of Telegram Stars that was received by the channel; for payments
            in Telegram Stars only.

    )r   r   star_amountrH   Nr   r   rH   r   rO   r   c                   sH   t  j|d || _|| _|| _|| _| j| j| j| jf| _|   d S r   )r   r   r   rH   r   rO   r   r   )r   r   rH   r   rO   r   r   r   r   r   T  s   	zSuggestedPostPaid.__init__r+   r,   r   r-   c                    F   |  |}t|dt||d< t|dt||d< t j||dS )r/   rH   rO   r2   )r3   r
   r4   r   r   r   r5   rL   r   r   r   r5   n  s   
zSuggestedPostPaid.de_json)NNNr:   )r    r!   r"   r#   r$   r%   r   r   r&   r   r   r   r=   r5   r'   r   r   r   r   rN   (  s*    )*rN   c                	       h   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 )SuggestedPostRefundeda  
    Describes a service message about a payment refund for a suggested post.

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

    .. versionadded:: 22.4

    Args:
        suggested_post_message (:class:`telegram.Message`, optional):
            Message containing the suggested post. Note that the :class:`~telegram.Message` object
            in this field will not contain the :attr:`~telegram.Message.reply_to_message` field
            even if it itself is a reply.
        reason (:obj:`str`):
            Reason for the refund. Currently,
            one of :tg-const:`telegram.constants.SuggestedPostRefunded.POST_DELETED` if the post
            was deleted within 24 hours of being posted or removed from scheduled messages without
            being posted, or :tg-const:`telegram.constants.SuggestedPostRefunded.PAYMENT_REFUNDED`
            if the payer refunded their payment.

    Attributes:
        suggested_post_message (:class:`telegram.Message`):
            Optional. Message containing the suggested post. Note that the
            :class:`~telegram.Message` object in this field will not contain
            the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply.
        reason (:obj:`str`):
            Reason for the refund. Currently,
            one of :tg-const:`telegram.constants.SuggestedPostRefunded.POST_DELETED` if the post
            was deleted within 24 hours of being posted or removed from scheduled messages without
            being posted, or :tg-const:`telegram.constants.SuggestedPostRefunded.PAYMENT_REFUNDED`
            if the payer refunded their payment.

    )reasonrH   Nr   rS   rH   r   c                   r   r   )r   r   rS   rH   r   r   )r   rS   rH   r   r   r   r   r     
   zSuggestedPostRefunded.__init__r+   r,   r   r-   c                    rI   rJ   rK   rL   r   r   r   r5     rM   zSuggestedPostRefunded.de_jsonr:   )r    r!   r"   r#   r$   r%   r   r   r   r   r=   r5   r'   r   r   r   r   rR   {  s    "*rR   c                       st   e Zd ZdZdZ		ddddej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 )SuggestedPostApprovedaH  
    Describes a service message about the approval of a suggested post.

    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.4

    Args:
        suggested_post_message (:class:`telegram.Message`, optional):
            Message containing the suggested post. Note that the :class:`~telegram.Message` object
            in this field will not contain the :attr:`~telegram.Message.reply_to_message` field
            even if it itself is a reply.
        price (:obj:`SuggestedPostPrice`, optional):
            Amount paid for the post.
        send_date (:class:`datetime.datetime`):
            Date when the post will be published.
            |datetime_localization|

    Attributes:
        suggested_post_message (:class:`telegram.Message`):
            Optional. Message containing the suggested post. Note that the
            :class:`~telegram.Message` object in this field will not contain
            the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply.
        price (:obj:`SuggestedPostPrice`):
            Optional. Amount paid for the post.
        send_date (:class:`datetime.datetime`):
            Date when the post will be published.
            |datetime_localization|

    )r)   r*   rH   Nr   r*   rH   r)   r   c                   s>   t  j|d || _|| _|| _| j| j| jf| _|   d S r   )r   r   r*   rH   r)   r   r   )r   r*   rH   r)   r   r   r   r   r     s   zSuggestedPostApproved.__init__r+   r,   r   r-   c                    sd   |  |}t|}t|d|d|d< t|dt||d< t|dt||d< t j||dS )r/   r*   r0   r)   rH   r2   )	r3   r   r   r4   r
   r   r   r   r5   r6   r   r   r   r5     s   
zSuggestedPostApproved.de_jsonr9   r:   )r    r!   r"   r#   r$   r;   r<   r   r   r   r   r   r=   r5   r'   r   r   r   r   rU     s$     *rU   c                	       rQ   )SuggestedPostApprovalFaileda  
    Describes a service message about the failed approval of a suggested post. Currently, only
    caused by insufficient user funds at the time of approval.

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

    .. versionadded:: 22.4

    Args:
        suggested_post_message (:class:`telegram.Message`, optional):
            Message containing the suggested post. Note that the :class:`~telegram.Message` object
            in this field will not contain the :attr:`~telegram.Message.reply_to_message` field
            even if it itself is a reply.
        price (:obj:`SuggestedPostPrice`):
            Expected price of the post.

    Attributes:
        suggested_post_message (:class:`telegram.Message`):
            Optional. Message containing the suggested post. Note that the
            :class:`~telegram.Message` object in this field will not contain
            the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply.
        price (:obj:`SuggestedPostPrice`):
            Expected price of the post.

    )r)   rH   Nr   r)   rH   r   c                   r   r   )r   r   r)   rH   r   r   )r   r)   rH   r   r   r   r   r   "  rT   z$SuggestedPostApprovalFailed.__init__r+   r,   r   r-   c                    rP   )r/   r)   rH   r2   )r3   r
   r4   r   r   r   r5   rL   r   r   r   r5   3  s   
z#SuggestedPostApprovalFailed.de_jsonr:   )r    r!   r"   r#   r$   r   r   r   r   r   r=   r5   r'   r   r   r   r   rV     s    *rV   )!r#   r<   r;   typingr   r   r   telegramr   telegram._messager   "telegram._payment.stars.staramountr   telegram._telegramobjectr   telegram._utilsr	   telegram._utils.argumentparsingr
   telegram._utils.datetimer   r   telegram._utils.typesr   r   r   r(   r>   rF   rN   rR   rU   rV   r   r   r   r   <module>   s*   6DQ8SBG