
    i	                        d Z ddlmZ ddlZddl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 ddlmZ ddlmZ d	d
lmZ erddl m!Z! ddlm"Z"  G d de          Z#dgZ$dS )zeThis implements the sub-component "AVAILABLE" of "VAVAILABILITY".

This is specified in :rfc:`7953`.
    )annotationsN)datetime)TYPE_CHECKING)CONCEPTS_TYPE_SETTERLINKS_TYPE_SETTERRELATED_TO_TYPE_SETTERcategories_propertycontacts_propertydescription_propertyduration_propertyexdates_propertylocation_propertyrdates_propertyrfc_7953_dtend_propertyrfc_7953_dtstart_propertyrfc_7953_duration_propertyrfc_7953_end_propertyrrules_propertysequence_propertysummary_propertyuid_property)get_example)InvalidCalendar   )	Component)Sequence)datec                       e Zd ZdZdZeZeZe	Z
eZeZeZeZeZeZeZddlmZ exZZeZ e d           Z!e"Z#e$Z%e&	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d*d+ fd$            Z'e&d,d-d)            Z( xZ)S ).	Availablea  Sub-component of "VAVAILABILITY from :rfc:`7953`.

    Description:
        "AVAILABLE" subcomponents are used to indicate periods of free
        time within the time range of the enclosing "VAVAILABILITY"
        component.  "AVAILABLE" subcomponents MAY include recurrence
        properties to specify recurring periods of time, which can be
        overridden using normal iCalendar recurrence behavior (i.e., use
        of the "RECURRENCE-ID" property).

    Examples:
        This is a recurring "AVAILABLE" subcomponent:

        .. code-block:: ics

            BEGIN:AVAILABLE
            UID:57DD4AAF-3835-46B5-8A39-B3B253157F01
            SUMMARY:Monday to Friday from 9:00 to 17:00
            DTSTART;TZID=America/Denver:20111023T090000
            DTEND;TZID=America/Denver:20111023T170000
            RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR
            LOCATION:Denver
            END:AVAILABLE

        You can get the same example from :meth:`example`:

        .. code-block: pycon

            >>> from icalendar import Available
            >>> a = Available.example()
            >>> str(a.summary)
            'Monday to Friday from 9:00 to 17:00'

    	AVAILABLEr   )RECURRENCE_ID N
categoriesSequence[str]commentslist[str] | str | Noneconceptsr   contactscreateddate | Nonedescription
str | Noneenddatetime | Nonelast_modifiedlinksr   locationrecurrence_iddate | datetime | Nonerefids
related_tor   sequence
int | Nonestampstartsummaryuidstr | uuid.UUID | Nonec          
     &   t                                          ||n|                                 ||||	|||          }||_        ||_        ||nt          j                    |_        ||_        ||_	        |
|_
        ||_        ||_        | j        rn|+t          |t                    r|j        t#          d          t          |t                    r|j        t#          d          |                    ||           ||_        ||_        |S )a	  Create a new Available component with all required properties.

        This creates a new Available component in accordance with :rfc:`7953`.

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

        Returns:
            :class:`Available`

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

        .. warning:: As time progresses, we will be stricter with the validation.
        N)r8   r)   r/   r%   r0   r5   r4   r'   z0Available end must be a datetime with a timezonez2Available start must be a datetime with a timezone)supernew_utc_nowr:   r+   uuiduuid4r;   r6   r#   r1   r(   r!   _validate_new
isinstancer   tzinfor   _validate_start_and_endr9   r-   )clsr#   r%   r'   r(   r)   r+   r-   r/   r0   r1   r2   r4   r5   r6   r8   r9   r:   r;   	available	__class__s                       R/root/projects/butler/venv/lib/python3.11/site-packages/icalendar/cal/available.pyr?   zAvailable.newb   s5   ~  %ww{{ ,%%#,,..'!  + 	 
 	 
	 $	 +	"DJLL	%	)	%	%	"/	 	:sH-- 141C%F   eX.. %,2F%H   --eS999		    
rfc_7953_1namestrreturnc                ^    |                      t          d|                    j        d         S )z0Return the calendar example with the given name.availabilitiesr   )	from_icalr   rH   )rG   rM   s     rJ   examplezAvailable.example   s)     }}[)94@@AAKANNrK   )r"   NNNNNNNNNNNNNNNNN)$r#   r$   r%   r&   r'   r   r(   r&   r)   r*   r+   r,   r-   r.   r/   r*   r0   r   r1   r,   r2   r3   r4   r&   r5   r   r6   r7   r8   r*   r9   r.   r:   r,   r;   r<   )rL   )rM   rN   rO   r   )*__name__
__module____qualname____doc__rM   r   r:   r   r+   r   r6   r	   r#   r   r;   r   r1   r
   r(   r   exdatesr   rdatesr   rrulesicalendar.attrr!   r   r9   DTSTARTr   DTENDr   DURATIONr   durationr   r-   classmethodr?   rS   __classcell__)rI   s   @rJ   r   r   *   s9       ! !F DG&K H$J
C H HGFF,,,,,,//EG#E  --H)H
C %'+/)-+/#"&#%)#'#04)--1#!!%"&*)_ _ _ _ _ _ [_B O O O O [O O O O OrK   r   )%rW   
__future__r   rA   r   typingr   r[   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   icalendar.cal.examplesr   icalendar.errorr   	componentr   collections.abcr   r   r   __all__r"   rK   rJ   <module>ri      s   
 # " " " " "                                                          ( / . . . . . + + + + + +             ((((((]O ]O ]O ]O ]O	 ]O ]O ]O@ -rK   