
    i                        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
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                       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          xZZ ed	deefed
          xZZed%d            Ze	 	 	 	 	 	 	 	 	 	 	 	 d&d' fd$            Z x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                @    | j         | j        dS | j        | j         z
  S )z)The duration computed from start and end.N)r   r   )selfs    R/root/projects/butler/venv/lib/python3.11/site-packages/icalendar/cal/free_busy.pydurationzFreeBusy.durationU   s'     <4:#54zDL((    N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               :   t                                          |	|	n|                                 |||||          }||nt          j                    |_        ||_        ||_        ||_        ||_	        |
|_
        | j        r|                     |
|           |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)r3   r(   r.   r2   r1   r*   )supernew_utc_nowuuiduuid4r6   r8   r/   r+   r,   r5   _validate_new_validate_start_and_end)clsr(   r*   r+   r,   r.   r/   r1   r2   r3   r5   r6   r8   	free_busy	__class__s                 r%   r<   zFreeBusy.new\   s    \ $ggkk ,%%#,,..! * 
 
	  #DJLL		'	%			 	4''s333r'   )r!   r"   )NNNNNNNNNNNN)r(   r)   r*   r   r+   r)   r,   r-   r.   r	   r/   r0   r1   r)   r2   r
   r3   r4   r5   r-   r6   r7   r8   r9   )__name__
__module____qualname____doc__namerequired
singletonsmultipler   r6   r   r8   r   r/   r   r+   r   r   r   r5   r   r,   r   propertyr&   classmethodr<   __classcell__)rD   s   @r%   r   r      s,        & DHJH C
C"I H,,	4b  EG )(	4u  C% ) ) ) X)  ,0)-+/&*#'.2)--1!(,&*> > > > > > [> > > > >r'   r   )rH   
__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%   <module>rW      s(   & & " " " " " "  . . . . . . . . . .            	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 . - - - - - +******B B B B By B B BJ ,r'   