
    3fi                     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Update 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   ed<    edd      Ze	e   ed<    edd      Zeed<   y)UpdateTaskSchemaz#Input schema for `TasksUpdateTask`..zThe ID of the task to update.)descriptiontask_idNzThe new title of the task.)defaultr   titlez*The new notes or description for the task.noteszhThe new status of the task. Use 'completed' to mark as complete, or 'needsAction' to mark as incomplete.statuszCThe new due date in RFC 3339 format (e.g., '2024-12-31T23:59:59Z').due@defaultzOThe task list ID containing the task. Use '@default' for the default task list.tasklist)__name__
__module____qualname____doc__r   r   str__annotations__r   r   r   r   r   r        j/var/www/auto_recruiter/arenv/lib/python3.12/site-packages/langchain_google_community/tasks/update_task.pyr
   r
      s    -*IJGSJ ;WXE8C=X "NE8C=  "6FHSM  Q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e   dee   dedee   defdZy)TasksUpdateTaskz)Tool that updates a task in Google Tasks.update_google_tasknamezUse this tool to update an existing task in Google Tasks. You can update the title, notes, status (completed/needsAction), or due date. You must provide the task ID.r   args_schemaNr   r   r   r   r   r   run_managerreturnc                 n   	 | j                   j                         j                  ||      j                         }|||d<   |||d<   |||d<   |||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  }|	j                  d      r|d|	d    z  }|S # t
        $ r}dt        |       cY d}~S d}~ww xY w)a  Update a task in Google Tasks.

        Args:
            task_id: The ID of the task to update.
            title: Optional new title.
            notes: Optional new notes.
            status: Optional new status ('completed' or 'needsAction').
            due: Optional new 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 update with updated details.
        )r   taskNr   r   r   r   )r   r%   bodyidUnknownzTask updated successfully!
ID: z
Title: z	
Status: z
Notes: z
Due: z+An error occurred while updating the task: )api_resourcetasksgetexecuteupdate	Exceptionr   )selfr   r   r   r   r   r   r"   r%   result
task_titleresponsees                r   _runzTasksUpdateTask._run;   si   0*	J !!'')--xg-NVVX 
   %W  %W!!'X!U !!'')dC  jjy1GGY7J9')J<XHzz(#j)9(:;;zz'"iw'899zz% gfUm_55O 	J@QII	Js   DD 	D4D/)D4/D4)NNNNr   N)r   r   r   r   r    r   r   r   r
   r!   r   r   r   r4   r   r   r   r   r   .   s    3$D#$	(   +;K&':
  $# $!";?BJBJ }BJ }	BJ
 BJ c]BJ BJ 78BJ 
BJr   r   N)r   typingr   r   langchain_core.callbacksr   pydanticr   r   %langchain_google_community.tasks.baser   r
   r   r   r   r   <module>r9      s1    $ ! > % ? y  FOJm OJr   