
    iQ              	           d Z ddlZddlZddlmZmZ ddlmZmZmZ  ej                  d      Z
ddddddddd	Z	 	 dd
edeeeef      dee   fdZy)zAlert hooks for Publishing Integrity system.

Provides a stub alert service that logs to structured output.
Can be extended to integrate with Slack, email, or other notification systems.
    N)datetimetimezone)DictAnyOptionalzpub-integrityhighmediumcritical)identity_collisionteam_mismatchprops_suppressedfreshness_staleregression_failureofficial_roster_mismatchplayer_wrong_teampublished_without_verification
alert_typedataseverityc           	         |xs t         j                  | d      }t        j                  t        j
                        j                         | ||xs i d}|dk(  r9t        j                  d|  dt        j                  |xs i t                      y|dk(  r9t        j                  d|  dt        j                  |xs i t                      yt        j                  d|  dt        j                  |xs i t                      y)	zu
    Trigger an alert. Currently logs structured output.
    Extend this to send to Slack, email, or dashboards.
    r	   )	timestamptyper   r   r
   z[ALERT] z: )defaultr   N)ALERT_THRESHOLDSgetr   nowr   utc	isoformatlogr
   jsondumpsstrwarninginfo)r   r   r   sevalert_payloads        F/var/www/html/rainmaker/backend/scripts/publishing_integrity/alerts.pytrigger_alertr(      s     
@&**:x@C \\(,,/99;
	M jx
|2djjS.Q-RST	hzl"TZZ
C-P,QRS8J<r$**TZR*M)NOP    )NN)__doc__r    loggingr   r   typingr   r   r   	getLoggerr   r   r"   r(    r)   r'   <module>r/      s      ' & &g( ! $ &#&,	  &*"QQ
4S>
"Q smQr)   