o
    .j"                     @  s   d Z ddlmZ ddlZddlmZmZmZ ddlmZ ddl	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ ddl m!Z! erjdd	l"m#Z# dd
l$m%Z%m&Z& ddl'm(Z( G dd deZ)dgZ*dS )z:rfc:`5545` VJOURNAL component.    )annotationsN)datedatetime	timedelta)TYPE_CHECKING)CONCEPTS_TYPE_SETTERLINKS_TYPE_SETTERRELATED_TO_TYPE_SETTERattendees_propertycategories_propertyclass_propertycolor_propertycontacts_propertycreate_single_propertydescriptions_propertyexdates_propertyimages_propertyorganizer_propertyrdates_propertyrrules_propertysequence_propertystatus_propertysummary_propertyuid_propertyurl_property)	Component)IncompleteComponent)Sequence)CLASSSTATUS)vCalAddressc                      s   e Zd ZdZdZdZdZdZedde	e
fe
dZedDddZejdEddZeZedFddZeZeZeZeZeZeZeZeZ e!Z"e#Z$e%Z&e'Z(e)Z*e+Z,e-Z.ddl/m0Z0 edGddZ1e1jdHddZ1e1j2dd Z1e3Z4e5																						dIdJ fdBdCZ6  Z7S )KJournalaN  A descriptive text at a certain time or associated with a component.

        Description:
            A "VJOURNAL" calendar component is a grouping of
            component properties that represent one or more descriptive text
            notes associated with a particular calendar date.  The "DTSTART"
            property is used to specify the calendar date with which the
            journal entry is associated.  Generally, it will have a DATE value
            data type, but it can also be used to specify a DATE-TIME value
            data type.  Examples of a journal entry include a daily record of
            a legislative body or a journal entry of individual telephone
            contacts for the day or an ordered list of accomplishments for the
            day.

    Examples:
        Create a new Journal:

            >>> from icalendar import Journal
            >>> journal = Journal.new()
            >>> print(journal.to_ical())
            BEGIN:VJOURNAL
            DTSTAMP:20250517T080612Z
            UID:d755cef5-2311-46ed-a0e1-6733c9e15c63
            END:VJOURNAL

    VJOURNAL)UIDDTSTAMP)r   COLORCREATEDDTSTARTr$   zLAST-MODIFIED	ORGANIZERzRECURRENCE-IDSEQUENCEr   SUMMARYr#   URL)ATTACHATTENDEE
CATEGORIESCOMMENTCONTACTEXDATERELATEDRDATERRULERSTATUSDESCRIPTIONr'   dtzjThe "DTSTART" property for a "VJOURNAL" that specifies the exact date at which the journal entry was made.returnr   c                 C  s   | j }|du rtd|S )zThe start of the Journal.

        The "DTSTART"
        property is used to specify the calendar date with which the
        journal entry is associated.
        NzNo DTSTART given.)r'   r   )selfstart r;   J/home/thesage/.local/lib/python3.10/site-packages/icalendar/cal/journal.pyr:   p   s   zJournal.startvaluedatetime | dateNonec                 C  
   || _ dS )zSet the start of the journal.N)r'   )r9   r=   r;   r;   r<   r:   }      
r   c                 C  s   t dS )z*The journal has no duration: timedelta(0).r   )r   r9   r;   r;   r<   duration      zJournal.durationr   )RECURRENCE_IDstrc                 C  s   | j }|sdS d|S )zThe concatenated descriptions of the journal.

        A Journal can have several descriptions.
        This is a compatibility method.
        Nz

)descriptionsjoin)r9   rG   r;   r;   r<   description   s   
zJournal.descriptionrI   
str | Nonec                 C  r@   )zSet the descriptionNrG   )r9   rI   r;   r;   r<   rI      rA   c                 C  s   | ` dS )zDelete all descriptions.NrK   rB   r;   r;   r<   rI      rD   Nr;   	attendeeslist[vCalAddress] | None
categoriesSequence[str]classificationCLASS | Nonecolorcommentslist[str] | str | Noneconceptsr   contactscreateddate | Nonestr | Sequence[str] | Nonelast_modifiedlinksr   	organizervCalAddress | str | Nonerecurrence_iddate | datetime | Nonerefids
related_tor	   sequence
int | Nonestampr:   statusSTATUS | Nonesummaryuidstr | uuid.UUID | Noneurlc             
     s   t  j|dur	|n|  ||
|||||d}||_|	|_|dur"|nt |_||_||_	||_
||_||_||_||_||_||_||_||_||_|S )a   Create a new journal entry with all required properties.

        This creates a new Journal in accordance with :rfc:`5545`.

        Parameters:
            attendees: The :attr:`attendees` of the journal.
            categories: The :attr:`categories` of the journal.
            classification: The :attr:`classification` of the journal.
            color: The :attr:`color` of the journal.
            comments: The :attr:`~icalendar.Component.comments` of the journal.
            concepts: The :attr:`~icalendar.Component.concepts` of the journal.
            contacts: The :attr:`contacts` of the journal.
            created: The :attr:`~icalendar.Component.created` of the journal.
            description: The :attr:`description` of the journal.
            end: The :attr:`end` of the journal.
            last_modified: The :attr:`~icalendar.Component.last_modified` of
                the journal.
            links: The :attr:`~icalendar.Component.links` of the journal.
            organizer: The :attr:`organizer` of the journal.
            recurrence_id: The :attr:`RECURRENCE_ID` of the journal.
            refids: :attr:`~icalendar.Component.refids` of the journal.
            related_to: :attr:`~icalendar.Component.related_to` of the journal.
            sequence: The :attr:`sequence` of the journal.
            stamp: The :attr:`~icalendar.Component.stamp` of the journal.
                If None, this is set to the current time.
            start: The :attr:`start` of the journal.
            status: The :attr:`status` of the journal.
            summary: The :attr:`summary` of the journal.
            uid: The :attr:`uid` of the journal.
                If None, this is set to a new :func:`uuid.uuid4`.
            url: The :attr:`url` of the journal.

        Returns:
            :class:`Journal`

        Raises:
            ~error.InvalidCalendar: If the content is not valid
                according to :rfc:`5545`.

        .. warning:: As time progresses, we will be stricter with the validation.
        N)rd   rW   rZ   rS   r[   ra   r`   rU   )supernew_utc_nowrg   rG   uuiduuid4rh   r:   rR   rN   rb   rP   rj   r\   rV   re   rL   rE   )clsrL   rN   rP   rR   rS   rU   rV   rW   rI   rZ   r[   r\   r^   r`   ra   rb   rd   r:   re   rg   rh   rj   journal	__class__r;   r<   rl      s4   D
zJournal.new)r8   r   )r=   r>   r8   r?   )r8   r   )r8   rF   )rI   rJ   )Nr;   NNNNNNNNNNNNNNNNNNNN),rL   rM   rN   rO   rP   rQ   rR   rJ   rS   rT   rU   r   rV   rT   rW   rX   rI   rY   rZ   rX   r[   r   r\   r]   r^   r_   r`   rT   ra   r	   rb   rc   rd   rX   r:   r_   re   rf   rg   rJ   rh   ri   rj   rJ   )8__name__
__module____qualname____doc__namerequired
singletonsmultipler   r   r   r'   propertyr:   setterendrC   r   rR   r   rb   r   rN   r   rdatesr   exdatesr   rrulesr   rh   r   rg   r   rG   r   rP   r   rj   r   r\   r   rV   r   re   r
   rL   icalendar.attrrE   rI   deleterr   imagesclassmethodrl   __classcell__r;   r;   rr   r<   r!   )   s    
r!   )+rw   
__future__r   rn   r   r   r   typingr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   icalendar.cal.componentr   icalendar.errorr   collections.abcr   icalendar.enumsr   r   icalendar.propr    r!   __all__r;   r;   r;   r<   <module>   s    X 
l