
    3fi5                     l    d Z ddlmZmZ ddlmZ ddlmZmZ ddl	m
Z
  G d de      Z G d d	e
      Zy
)zCreate a task in Google Tasks.    )OptionalType)CallbackManagerForToolRun)	BaseModelField)TasksBaseToolc                       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   ed<    edd      Zeed<   y)CreateTaskSchemaz#Input schema for `TasksCreateTask`..zThe title of the task.)descriptiontitleNz"Notes or description for the task.)defaultr   noteszQDue date of the task in RFC 3339 format (e.g., '2024-12-31T23:59:59Z'). Optional.due@defaultzQThe task list ID to create the task in. Use '@default' for the default task list.tasklist)__name__
__module____qualname____doc__r   r   str__annotations__r   r   r   r        j/var/www/auto_recruiter/arenv/lib/python3.12/site-packages/langchain_google_community/tasks/create_task.pyr
   r
      sl    -s(@AE3A "FE8C=  C#  8Hc r   r
   c                   ~    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e   dedee   defdZy)TasksCreateTaskz)Tool that creates a task in Google Tasks.create_google_tasknamezUse this tool to create a new task in Google Tasks. The input must include the title of the task. You can optionally include notes and a due date.r   args_schemaNr   r   r   r   run_managerreturnc                    	 d|i}|r||d<   |r||d<   | j                   j                         j                  ||      j                         }|j	                  dd      }|j	                  dd      }	d| d|	 }
|j	                  d      r|
d	|d    z  }
|j	                  d      r|
d
|d    z  }
|
S # t
        $ r}dt        |       cY d}~S d}~ww xY w)a  Create a task in Google Tasks.

        Args:
            title: The title of the task.
            notes: Optional notes or description for the task.
            due: Optional due date in RFC 3339 format.
            tasklist: The task list ID. Defaults to '@default'.
            run_manager: Optional callback manager.

        Returns:
            A string confirming the task creation with task details.
        r   r   r   )r   bodyidUnknownzTask created successfully!
ID: z
Title: z
Notes: z
Due: z+An error occurred while creating the task: N)api_resourcetasksinsertexecuteget	Exceptionr   )selfr   r   r   r   r    	task_bodyresulttask_id
task_titleresponsees               r   _runzTasksCreateTask._run2   s    (	J %(I%*	'"#&	%  !!'')	:  jjy1GGY7J9')J<XHzz'"iw'899zz% gfUm_55O 	J@QII	Js   B0B3 3	C<C	CC)NNr   N)r   r   r   r   r   r   r   r   r
   r   r   r   r   r3   r   r   r   r   r   %   s    3$D#$	;   +;K&':
  $!";?1J1J }1J c]	1J
 1J 781J 
1Jr   r   N)r   typingr   r   langchain_core.callbacksr   pydanticr   r   %langchain_google_community.tasks.baser   r
   r   r   r   r   <module>r8      s.    $ ! > % ?y 4>Jm >Jr   