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 ddlmZ er>ddlmZ G d	d
 d
eZd
gZdS )z :rfc:`5545` VFREEBUSY component.    )annotationsN)datedatetime	timedelta)TYPE_CHECKING)CONCEPTS_TYPE_SETTERLINKS_TYPE_SETTERRELATED_TO_TYPE_SETTERcontacts_propertycreate_single_propertyorganizer_propertyuid_propertyurl_property)	Component)vCalAddressc                      s   e Zd ZdZdZdZdZdZeZ	e
ZeZeZeddeefed ZZed	deefed
 ZZed'ddZe												d(d) fd%d&Z  ZS )*FreeBusyaZ  
        A "VFREEBUSY" calendar component is a grouping of component
        properties that represents either a request for free or busy time
        information, a reply to a request for free or busy time
        information, or a published set of busy time information.

    Examples:
        Create a new FreeBusy:

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

    	VFREEBUSY)UIDDTSTAMP)CONTACTDTSTARTDTENDr   	ORGANIZERr   URL)ATTENDEECOMMENTFREEBUSYRSTATUSr   dtzXThe "DTSTART" property for a "VFREEBUSY" specifies the inclusive start of the component.r   zkThe "DTEND" property for a "VFREEBUSY" calendar component specifies the non-inclusive end of the component.returntimedelta | Nonec                 C  s$   | j du s
| jdu rdS | j| j  S )z)The duration computed from start and end.N)r   r   )self r"   L/home/thesage/.local/lib/python3.10/site-packages/icalendar/cal/free_busy.pydurationU   s   zFreeBusy.durationNcommentslist[str] | str | Noneconceptsr   contactsenddate | datetime | Nonelinksr   	organizervCalAddress | str | Nonerefids
related_tor	   stampdate | Nonestartuidstr | uuid.UUID | Noneurl
str | Nonec                  sr   t  j|	dur	|	n|  |||||d}|dur|nt |_||_||_||_||_	|
|_
| jr7| |
| |S )a  Create a new alarm with all required properties.

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

        Parameters:
            comments: The :attr:`~icalendar.Component.comments` of the component.
            concepts: The :attr:`~icalendar.Component.concepts` of the component.
            contacts: The :attr:`contacts` of the component.
            end: The :attr:`end` of the component.
            links: The :attr:`~icalendar.Component.links` of the component.
            organizer: The :attr:`organizer` of the component.
            refids: :attr:`~icalendar.Component.refids` of the component.
            related_to: :attr:`~icalendar.Component.related_to` of the component.
            stamp: The :attr:`DTSTAMP` of the component.
                If None, this is set to the current time.
            start: The :attr:`start` of the component.
            uid: The :attr:`uid` of the component.
                If None, this is set to a new :func:`uuid.uuid4`.
            url: The :attr:`url` of the component.

        Returns:
            :class:`FreeBusy`

        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)r0   r%   r+   r/   r.   r'   )supernew_utc_nowuuiduuid4r3   r5   r,   r(   r)   r2   _validate_new_validate_start_and_end)clsr%   r'   r(   r)   r+   r,   r.   r/   r0   r2   r3   r5   	free_busy	__class__r"   r#   r8   \   s"   .zFreeBusy.new)r   r    )NNNNNNNNNNNN)r%   r&   r'   r   r(   r&   r)   r*   r+   r   r,   r-   r.   r&   r/   r	   r0   r1   r2   r*   r3   r4   r5   r6   )__name__
__module____qualname____doc__namerequired
singletonsmultipler   r3   r   r5   r   r,   r
   r(   r   r   r   r2   r   r)   r   propertyr$   classmethodr8   __classcell__r"   r"   r@   r#   r      sP    	r   )rE   
__future__r   r:   r   r   r   typingr   icalendar.attrr   r   r	   r
   r   r   r   r   icalendar.cal.componentr   icalendar.propr   r   __all__r"   r"   r"   r#   <module>   s    (
 
