
    i                    @    d Z ddlmZ ddlmZ 	 	 dddZddZddZdS )uz  
JMAP Calendar method builders and response parsers.

These are pure functions — no HTTP, no state. They build the request
tuples that go into a ``methodCalls`` list, and parse the corresponding
``methodResponses`` entries.

Method shapes follow RFC 8620 §3.3 (get), §3.4 (changes), §3.5 (set); Calendar-specific
properties are defined in the JMAP Calendars specification.
    )annotations)JMAPCalendarN
account_idstridslist[str] | None
propertiesreturntuplec                $    | |d}|||d<   d|dfS )a  Build a ``Calendar/get`` method call tuple.

    Args:
        account_id: The JMAP accountId to query.
        ids: List of calendar IDs to fetch, or ``None`` to fetch all.
        properties: List of property names to return, or ``None`` for all.

    Returns:
        A 3-tuple ``("Calendar/get", arguments_dict, call_id)`` suitable
        for inclusion in a ``methodCalls`` list.
    )	accountIdr   Nr	   zCalendar/getz	cal-get-0 )r   r   r	   argss       X/root/projects/butler/venv/lib/python3.11/site-packages/caldav/jmap/_methods/calendar.pybuild_calendar_getr      s.       *#66D'\D+..    response_argsdictlist[JMAPCalendar]c                B    d |                      dg           D             S )aj  Parse the arguments dict from a ``Calendar/get`` method response.

    Args:
        response_args: The second element of a ``methodResponses`` entry
            whose method name is ``"Calendar/get"``.

    Returns:
        List of :class:`~caldav.jmap.objects.calendar.JMAPCalendar` objects.
        Returns an empty list if ``"list"`` is absent or empty.
    c                6    g | ]}t          j        |          S r   )r   	from_jmap).0items     r   
<listcomp>z&parse_calendar_get.<locals>.<listcomp>2   s#    SSSTL"4((SSSr   list)get)r   s    r   parse_calendar_getr   '   s)     TS]5F5Fvr5R5RSSSSr   since_statec                    d| |ddfS )a<  Build a ``Calendar/changes`` method call tuple.

    Args:
        account_id: The JMAP accountId to query.
        since_state: The ``state`` string from a previous ``Calendar/get``
            or ``Calendar/changes`` response.

    Returns:
        A 3-tuple ``("Calendar/changes", arguments_dict, call_id)``.
    zCalendar/changes)r   
sinceStatezcal-changes-0r   )r   r   s     r   build_calendar_changesr"   5   s     	 << r   )NN)r   r   r   r   r	   r   r
   r   )r   r   r
   r   )r   r   r   r   r
   r   )__doc__
__future__r   caldav.jmap.objects.calendarr   r   r   r"   r   r   r   <module>r&      s   	 	 # " " " " " 5 5 5 5 5 5
 !#'/ / / / /,T T T T     r   