
    dh                         S r SSKJr  SSKJrJrJr  SSKJr  SSK	J
r
  SSKJrJr  SSKJr  SSKJr   " S	 S
\5      r " S S\5      rg)zUtil that sends calendar events in Office 365.

Free, but setup is required. See link below.
https://learn.microsoft.com/en-us/graph/auth/
    )datetime)ListOptionalType)ZoneInfo)CallbackManagerForToolRun)	BaseModelField)O365BaseTool)
UTC_FORMATc                       \ rS rSr% Sr\" SSS9r\\S'   \" SSS9r	\
\   \S'   \" SS	S9r\\S
'   \" SS9r\\S'   \" SS9r\\S'   Srg)SendEventSchema   zInput for CreateEvent Tool..z)The message body to include in the event.)descriptionbodyz$The list of attendees for the event.	attendeeszThe subject of the event.subjectug   The start datetime for the event in the following format:  YYYY-MM-DDTHH:MM:SS±hh:mm, where "T" separates the date and time  components, and the time zone offset is specified as ±hh:mm.  For example: "2023-06-09T10:30:00+03:00" represents June 9th,  2023, at 10:30 AM in a time zone with a positive offset of 3  hours from Coordinated Universal Time (UTC).start_datetimeue   The end datetime for the event in the following format:  YYYY-MM-DDTHH:MM:SS±hh:mm, where "T" separates the date and time  components, and the time zone offset is specified as ±hh:mm.  For example: "2023-06-09T10:30:00+03:00" represents June 9th,  2023, at 10:30 AM in a time zone with a positive offset of 3  hours from Coordinated Universal Time (UTC).end_datetime N)__name__
__module____qualname____firstlineno____doc__r
   r   str__annotations__r   r   r   r   r   __static_attributes__r       f/var/www/html/shao/venv/lib/python3.13/site-packages/langchain_community/tools/office365/send_event.pyr   r      s    %?D#  !:ItCy  /GS   8NC  8L# r   r   c                       \ rS rSr% SrSr\\S'   Sr\\S'   \	r
\\	   \S'    SS	\S
\\   S\S\S\S\\   S\4S jjrSrg)O365SendEvent3   z/Tool for sending calendar events in Office 365.
send_eventnamezIUse this tool to create and send an event with the provided event fields.r   args_schemaNr   r   r   r   r   run_managerreturnc                    U R                   R                  5       nUR                  5       nUR                  5       n	Xl        X9l         [        R                  " U5      R                  [        S5      S9U	l
         [        R                  " U5      R                  [        S5      S9U	l        U H  n
U	R                  R!                  U
5        M      U	R#                  5         S[%        U	5      -   nU$ ! [         a#    [        R                  " U[        5      U	l
         Nf = f! [         a#    [        R                  " U[        5      U	l         Nf = f)NUTC)tzinfozEvent sent: )accountscheduleget_default_calendar	new_eventr   r   dtfromisoformatreplacer   start
ValueErrorstrptimer   endr   addsaver   )selfr   r   r   r   r   r'   r-   calendareventattendeeoutputs               r    _runO365SendEvent._run<   s    <<((*002""$
	B**>:BB C EK	>((6>>huo>VEI
 "HOO) " 	

#e*,  	B++njAEK	B
  	>L*=EI	>s$   1C/ :1D /*DD*EEr   )N)r   r   r   r   r   r%   r   r   r   r   r&   r   r   r   r   r>   r   r   r   r    r"   r"   3   s    9D#S   *9Ko&8 <@$$ 9$ 	$
 $ $ 78$ 
$ $r   r"   N)r   r   r0   typingr   r   r   zoneinfor   langchain_core.callbacksr   pydanticr	   r
   (langchain_community.tools.office365.baser   )langchain_community.tools.office365.utilsr   r   r"   r   r   r    <module>rF      s=    $ ' '  > % A @i B-L -r   