
    cjg                        d dl mZ d dlZd dlZd dlmZmZ d dlmZ d dlm	Z	 ddZ
dddddd		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
Zy)    )annotationsN)datetimetimezone)
Connection)Anyc                 d    t        j                  t        j                        j	                         S )N)r   nowr   utc	isoformat     X/home/agent/.hermes/worktrees/FinanceManager-main-deploy/src/jarvis_finance/audit/log.pyutc_nowr   
   s    <<%//11r   Tsystem)
old_values
new_valuesuser_text_note	confirmed
created_byc       	           t        t        j                               }
t               }| j	                  d|
|||||t        j                  |xs i d      t        j                  |xs i d      ||rdnd|r|nd |	|f       |
S )Na.  
        INSERT INTO audit_log(
            audit_id, timestamp, source, action, entity_type, entity_id,
            old_values_json, new_values_json, user_text_note, confirmed,
            confirmation_timestamp, created_by, created_at
        ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
        T)	sort_keys   r   )struuiduuid4r   executejsondumps)connsourceactionentity_type	entity_idr   r   r   r   r   audit_idr	   s               r   record_audit_eventr%      s     4::< H
)CLL	 JJz'R48JJz'R48AC$	
0 Or   )returnr   )r   r   r    r   r!   r   r"   r   r#   r   r   dict[str, Any] | Noner   r'   r   z
str | Noner   boolr   r   r&   r   )
__future__r   r   r   r   r   sqlite3r   typingr   r   r%   r   r   r   <module>r,      s    "   '  2 )-(,!%'
' ' 	'
 ' ' &' &' ' ' ' 	'r   