Ë
    Fü´j0  ã                  óx   — d Z ddlmZ ddlmZ ddlmZmZ ddlmZ ddl	m
Z
 ddlmZ erddlZ G d	„ d
ee
«      Zy)zProvide the Announcement class.é    )Úannotations)Údatetime)ÚTYPE_CHECKINGÚAny)ÚAPI_PATH)Ú
RedditBase)ÚFullnameMixinNc                  ó”   ‡ — e Zd ZdZdZed
d„«       Zedd„«       Zedd„«       Z	edd„«       Z
	 	 d	 	 	 	 	 	 	 dˆ fd„Zdd„Zdd	„Zˆ xZS )ÚAnnouncementa°  A class that represents a Reddit announcement.

    .. include:: ../../typical_attributes.rst

    ================= =================================================================
    Attribute         Description
    ================= =================================================================
    ``body_html``     The announcement's body, rendered as HTML.
    ``body``          The announcement's body, in Markdown.
    ``id``            The fullname of the announcement, e.g. ``'ann_4sc833'``.
    ``permalink``     The announcement's permalink (to view on the web).
    ``read_at``       Timestamp the announcement was read, in ISO-8601 format. ``None``
                      if the announcement has not been read.
    ``read_datetime`` ``read_at`` as a timezone-aware :class:`datetime.datetime`, or
                      ``None`` if the announcement has not been read.
    ``sent_at``       Timestamp the announcement was sent, in ISO-8601 format.
    ``sent_datetime`` ``sent_at`` as a timezone-aware :class:`datetime.datetime`.
    ``subject``       The subject line of the announcement.
    ================= =================================================================

    Úidc                óh   — t        j                  | j                  dd«      «      j                  «       S )NÚZz+00:00)r   ÚfromisoformatÚreplaceÚ
astimezone)Úvalues    ú]/root/workspace/ytshorts/venv/lib/python3.12/site-packages/praw/models/reddit/announcement.pyÚ_parse_iso8601zAnnouncement._parse_iso8601)   s)   € ô ×%Ñ% e§m¡m°C¸Ó&BÓC×NÑNÓPÐPó    c                 ó   — y)zThe object's kind shortcode.Úann© ©Úselfs    r   Ú_kindzAnnouncement._kind.   s   € ð r   c                óR   — | j                   €y| j                  | j                   «      S )zàThe time the announcement was read as a timezone-aware :class:`datetime.datetime`.

        Returns ``None`` if the announcement has not been read. The returned object is
        localized to the system's timezone.

        N)Úread_atr   r   s    r   Úread_datetimezAnnouncement.read_datetime3   s&   € ð �<‰<ÐØØ×"Ñ" 4§<¡<Ó0Ð0r   c                ó8   — | j                  | j                  «      S )z The time the announcement was sent as a timezone-aware :class:`datetime.datetime`.

        The returned object is localized to the system's timezone.

        )r   Úsent_atr   s    r   Úsent_datetimezAnnouncement.sent_datetime?   s   € ð ×"Ñ" 4§<¡<Ó0Ð0r   c                ó†   •— ||fj                  d«      dk7  rd}t        |«      ‚|r|| _        t        ‰| �  |||du¬«       y)z.Initialize an :class:`.Announcement` instance.Né   z0Exactly one of 'id' or '_data' must be provided.)Ú_dataÚ_fetched)ÚcountÚ	TypeErrorr   ÚsuperÚ__init__)r   Úredditr   r$   ÚmsgÚ	__class__s        €r   r)   zAnnouncement.__init__H   sN   ø€ ð �ˆ;×Ñ˜TÓ" aÒ'ØDˆCÜ˜C“.Ð ÙØˆDŒGÜ‰Ñ˜ u°uÀDÐ7HÐÕIr   c                ód   — | j                   j                  t        d   d| j                  i¬«       y)a!  Hide the announcement.

        Example usage:

        .. code-block:: python

            for announcement in reddit.announcements():
                announcement.hide()

        .. seealso::

            :meth:`.AnnouncementHelper.hide` to hide multiple announcements at once.

        Úhide_announcementsÚids©ÚdataN©Ú_redditÚpostr   Úfullnamer   s    r   ÚhidezAnnouncement.hideV   s*   € ð 	�‰×Ñœ(Ð#7Ñ8ÀÀtÇ}Á}Ð?UÐÕVr   c                ód   — | j                   j                  t        d   d| j                  i¬«       y)aé  Mark the announcement as read.

        Example usage:

        .. code-block:: python

            for announcement in reddit.announcements():
                if announcement.read_at is None:
                    announcement.mark_read()

        .. seealso::

            - :meth:`.AnnouncementHelper.mark_read` to mark multiple announcements as
              read at once.
            - :meth:`.AnnouncementHelper.mark_all_read` to mark all announcements as
              read.

        Úread_announcementsr/   r0   Nr2   r   s    r   Ú	mark_readzAnnouncement.mark_readg   s*   € ð& 	�‰×Ñœ(Ð#7Ñ8ÀÀtÇ}Á}Ð?UÐÕVr   )r   ÚstrÚreturnr   )r;   r:   )r;   zdatetime | None)r;   r   )NN)r*   zpraw.Redditr   z
str | Noner$   zdict[str, Any] | Noner;   ÚNone)r;   r<   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	STR_FIELDÚstaticmethodr   Úpropertyr   r   r!   r)   r6   r9   Ú__classcell__)r,   s   @r   r   r      s£   ø„ ñð, €IàòQó ðQð òó ðð ò	1ó ð	1ð ò1ó ð1ð Ø'+ð	JàðJð ðJð %ð	Jð
 
õJóW÷"Wr   r   )r@   Ú
__future__r   r   Útypingr   r   Ú
praw.constr   Úpraw.models.reddit.baser   Ú"praw.models.reddit.mixins.fullnamer	   Úprawr   r   r   r   ú<module>rK      s2   ðÙ %å "å ß %å Ý .Ý <áÛôjW�= *õ jWr   