o
    l>j                     @  s&  d Z ddlmZ ddlmZ ddlmZmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ G d	d
 d
eZG dd deeZG dd deeZG dd deeZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd  d eZd!S )"zUser-facing Invites data transfer objects.

These types form the public API surface; users of :class:`InvitesService`
will receive and pass these. All are :class:`FrozenServiceModel` subclasses
(immutable, strictly validated).
    )annotations)datetime)EnumIntEnum)Optional)Field)FrozenServiceModel)SHARE_URL_PREFIXc                   @  s    e Zd ZdZdZdZdZdZdS )
RsvpStatuszCGuest's RSVP response state (encrypted ``status`` int on the wire).r            N)__name__
__module____qualname____doc__NO_RESPONSE	NOT_GOINGMAYBEGOING r   r   Y/home/thesage/.local/lib/python3.10/site-packages/pyicloud/services/invites/models/dto.pyr
      s    r
   c                   @     e Zd ZdZdZdZdZdS )ParticipantTypez3Type of participant on a ``cloudkit.share`` record.OWNERPUBLIC_USERUSERN)r   r   r   r   r   r   r   r   r   r   r   r      
    r   c                   @  r   )AcceptanceStatusz,Guest's acceptance status for an invitation.ACCEPTEDINVITEDREMOVEDN)r   r   r   r   r   r    r!   r   r   r   r   r   %   r   r   c                   @  s   e Zd ZdZdZdZdS )
EventScopez?Which CK database scope an event lives in for the current user.privatesharedN)r   r   r   r   PRIVATESHAREDr   r   r   r   r"   -   s    r"   c                   @  s>   e Zd ZU dZded< dZded< dZded	< dZded
< dS )	EventTimez&Decoded ``EventDetails.time`` payload.r   startNOptional[datetime]endFbool
is_all_dayis_open_ended)r   r   r   r   __annotations__r*   r,   r-   r   r   r   r   r'   4   s   
 r'   c                   @  sf   e Zd ZU dZdZded< dZded< dZded< dZded< dZ	ded	< dZ
ded
< dZded< dS )
EventPlacezDecoded ``EventDetails.place`` payload.

    All fields are optional. Events without a physical location may carry
    only ``city`` and ``time_zone_identifier``.
    NOptional[str]titlesubtitlecitytime_zone_identifierzOptional[float]latitude	longitudeurl)r   r   r   r   r1   r.   r2   r3   r4   r5   r6   r7   r   r   r   r   r/   =   s   
 r/   c                   @  sb   e Zd ZU dZded< dZded< dZded< dZded< dZded	< d
ed< ded< ded< dS )Participantz7A participant on the event's ``cloudkit.share`` record.strparticipant_idNr0   user_record_name
given_namefamily_nameemailr   typer   acceptance_status
permission)	r   r   r   r   r.   r;   r<   r=   r>   r   r   r   r   r8   M   s   
 r8   c                   @  sF   e Zd ZU dZded< ded< dZded< dZded	< dZded
< dS )OneTimeLinkGuestz5Guest invited via the email/phone one-time-link flow.r9   record_namer:    namer   tuple[str, ...]emailsphone_numbersN)r   r   r   r   r.   rE   rG   rH   r   r   r   r   rB   Z   s   
 rB   c                   @  sT   e Zd ZU dZded< ded< dZded< dZded	< d
Zded< edddZ	d
S )
EventSharez-View of an event's ``cloudkit.share`` record.r9   
short_guidpublic_permissionr   ztuple[Participant, ...]participantsztuple[OneTimeLinkGuest, ...]one_time_linksNr0   current_user_participant_idreturnc                 C  s   t  | j S )zBPublic invite URL: ``https://www.icloud.com/invites/<shortGUID>``.)r	   rJ   )selfr   r   r   r7   p   s   zEventShare.url)rO   r9   )
r   r   r   r   r.   rL   rM   rN   propertyr7   r   r   r   r   rI   d   s   
 rI   c                   @  sr   e Zd ZU dZded< ded< dZded< ded< d	Zd
ed< dZded< dZded< d	Z	d
ed< d	Z
d
ed< d	S )RsvpzA guest's RSVP response.r9   rC   r:   rD   rE   r
   statusNr0   messager   intnum_additional_adultsnum_additional_kidsimage_download_urlrecord_change_tag)r   r   r   r   r.   rE   rT   rV   rW   rX   rY   r   r   r   r   rR   v   s   
 rR   c                   @  s  e Zd ZU dZded< ded< dZded< d	Zded
< d	Zded< d	Zded< dZ	ded< dZ
ded< dZded< dZded< dZded< dZded< dZded< dZded< eedZded< eedZded< d Zd!ed"< dZd#ed$< dZd#ed%< dZd&ed'< d Zd(ed)< dS )*Eventz5An Invites event from the current user's perspective.r9   event_idr"   scopeNr0   rY   rD   r1   noteshost_display_nameFr+   is_published
is_privateis_cancelledblock_new_rsvpszOptional[int]max_attendeesr   rU   max_additional_guests_per_rsvpzOptional[EventTime]timezOptional[EventPlace]place)default_factorydict
backgroundstyler   rF   integrationsr)   created_timestampmodified_timestampzOptional[EventShare]shareztuple[Rsvp, ...]rsvps)r   r   r   r   r.   rY   r1   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   r   rh   ri   rj   rk   rl   rm   rn   ro   r   r   r   r   rZ      s.   
 rZ   c                   @  sr   e Zd ZU dZded< ded< dZded< dZded< dZded	< dZded
< ded< ded< ded< ded< dS )ResolvedSharezAPreview returned by ``records/resolve`` before accepting a share.r9   rJ   r[   Nr0   owner_record_nameowner_emailowner_given_nameowner_family_nameparticipant_statusparticipant_typeparticipant_permissionrI   rn   )	r   r   r   r   r.   rq   rr   rs   rt   r   r   r   r   rp      s   
 rp   N)r   
__future__r   r   enumr   r   typingr   pydanticr   pyicloud.common.modelsr   $pyicloud.services.invites._constantsr	   r
   r9   r   r   r"   r'   r/   r8   rB   rI   rR   rZ   rp   r   r   r   r   <module>   s(    		
