a
    bg                     @   s   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
 d
eZG dd deZdS )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                   @   sv   e Zd ZU dZedddZeed< edddZe	e ed< edddZ
eed	< ed
dZeed< eddZeed< dS )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    r   r   |/var/www/html/cobodadashboardai.evdpl.com/venv/lib/python3.9/site-packages/langchain_community/tools/office365/send_event.pyr      s&   
r   c                	   @   s^   e Zd ZU dZdZeed< dZeed< eZ	e
e ed< deee eeeee edd	d
ZdS )O365SendEventz/Tool for sending calendar events in Office 365.Z
send_eventnamezIUse this tool to create and send an event with the provided event fields.r   args_schemaN)r   r   r   r   r   run_managerreturnc                 C   s   | j  }| }| }	||	_||	_zt|jt	dd|	_
W n  tyb   t|t|	_
Y n0 zt|jt	dd|	_W n  ty   t|t|	_Y n0 |D ]}
|	j|
 q|	  dt|	 }|S )NUTC)tzinfozEvent sent: )accountscheduleZget_default_calendarZ	new_eventr   r   dtfromisoformatreplacer   start
ValueErrorstrptimer   endr   addsaver   )selfr   r   r   r   r   r   r#   calendareventZattendeeoutputr   r   r   _run<   s(    


zO365SendEvent._run)N)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r1   r   r   r   r   r   3   s   

	 r   N)r   r   r$   typingr   r   r   Zzoneinfor   Zlangchain_core.callbacksr   Zpydanticr   r	   Z(langchain_community.tools.office365.baser
   Z)langchain_community.tools.office365.utilsr   r   r   r   r   r   r   <module>   s   !