
    h                         d Z ddlmZ ddlmZmZm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  G d	 d
e      Z G d de      Zy)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                       e Zd ZU dZ edd      Zeed<    edd      Ze	e   ed<    edd      Z
eed	<    ed
      Zeed<    ed      Zeed<   y)SendEventSchemaz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_datetimeN)__name__
__module____qualname____doc__r
   r   str__annotations__r   r   r   r   r        l/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/langchain_community/tools/office365/send_event.pyr   r      s    %?D#  !:ItCy  /GS   8NC  8L# r   r   c                   v    e Zd ZU dZdZeed<   dZeed<   eZ	e
e   ed<   	 dded	ee   d
edededee   defdZy)O365SendEventz/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                    | j                   j                         }|j                         }|j                         }	||	_        ||	_        	 t        j                  |      j                  t        d            |	_
        	 t        j                  |      j                  t        d            |	_        |D ]  }
|	j                  j!                  |
        |	j#                          dt%        |	      z   }|S # t        $ r" t        j                  |t              |	_
        Y w xY w# t        $ r" t        j                  |t              |	_        Y w xY w)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   _runzO365SendEvent._run<   s!    <<((*002""$
	B**>:BB C EK	>((6>>huo>VEI
 " 	*HOO)	* 	

#e*,  	B++njAEK	B
  	>L*=EI	>s$   
3C3 >3D! 3(DD!(EE)N)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   r,   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>rA      s=    $ ' '  > % A @i B-L -r   