Ë
    Ìi  ã                   óÖ   — d dl Z d dlmZmZ d dlmZmZmZmZm	Z	 d dl
mZ  e j                  «         e j                  e«      Zej!                  e j"                  «       	  G d„ d«      Zy)é    N)ÚDictÚOptional)ÚTrackerÚEmitterÚsubjectÚEmitterConfigurationÚTrackerConfiguration)ÚMethodc                   ó  — e Zd ZU i Zeeef   ed<   eddd e	«        e
«       fdedededee   deej                     d	e	d
e
defd„«       Zededefd„«       Zedefd„«       Zedefd„«       Zed„ «       Zededee   fd„«       Zy)ÚSnowplowÚ	_trackersÚpostNÚ	namespaceÚendpointÚmethodÚapp_idr   Útracker_configÚemitter_configÚreturnc                 óZ  — |€t        d«      ‚t        |||j                  |j                  |j                  |j
                  |j                  |j                  |j                  |j                  ¬«
      }t        | ||||j                  |j                  ¬«      }t        j                  |«      S )aq  
        Create a Snowplow tracker with a namespace and collector URL

        :param  namespace:          Name of the tracker
        :type   namespace:          String
        :param  endpoint:           The collector URL
        :type   endpoint:           String
        :param  method:             The HTTP request method. Defaults to post.
        :type   method:             method
        :param  appId:              Application ID
        :type   appId:              String | None
        :param  subject:            Subject to be tracked
        :type   subject:            Subject | None
        :param  tracker_config:     Tracker configuration
        :type   tracker_config:     TrackerConfiguration
        :param  emitter_config:     Emitter configuration
        :type   emitter_config:     EmitterConfiguration
        :rtype                      Tracker
        z)Emitter or Collector URL must be provided)
r   r   Ú
batch_sizeÚ
on_successÚ
on_failureÚ
byte_limitÚrequest_timeoutÚcustom_retry_codesÚevent_storeÚsession)r   Úemittersr   r   Úencode_base64Újson_encoder)Ú	TypeErrorr   r   r   r   r   r   r   r   r   r   r    r!   r   Úadd_tracker)	r   r   r   r   r   r   r   ÚemitterÚtrackers	            úZ/var/www/html/strategist-ai/venv/lib/python3.12/site-packages/snowplow_tracker/snowplow.pyÚcreate_trackerzSnowplow.create_tracker*   s«   € ð: ÐÜÐGÓHÐHäØØØ%×0Ñ0Ø%×0Ñ0Ø%×0Ñ0Ø%×0Ñ0Ø*×:Ñ:Ø-×@Ñ@Ø&×2Ñ2Ø"×*Ñ*ô
ˆô ØØØØØ(×6Ñ6Ø'×4Ñ4ô
ˆô ×#Ñ# GÓ,Ð,ó    r%   c                 ó.  — t        |t        «      st        j                  d«       y|j	                  «       }|| j
                  j                  «       v rt        d«      ‚|| j
                  |<   t        j                  d|z   dz   «       | j
                  |   S )zÀ
        Add a Snowplow tracker to the Snowplow object

        :param  tracker:  Tracker object to add to Snowplow
        :type   tracker:  Tracker
        :rtype            Tracker
        zTracker not provided.Nz*Tracker with this namespace already existsúTracker with namespace: 'z' added to Snowplow)Ú
isinstancer   ÚloggerÚinfoÚget_namespacer   Úkeysr"   ©Úclsr%   r   s      r&   r#   zSnowplow.add_trackerb   s‚   € ô ˜'¤7Ô+Ü�K‰KÐ/Ô0Øà×)Ñ)Ó+ˆ	à˜Ÿ™×*Ñ*Ó,Ñ,ÜÐHÓIÐIà#*ˆ�‰�iÑ Ü�‰Ð/°)Ñ;Ð>SÑSÔTØ�}‰}˜YÑ'Ð'r(   c                 óF   — |j                  «       }| j                  |«       y)zÈ
        Remove a Snowplow tracker from the Snowplow object if it exists

        :param  tracker:        Tracker object to remove from Snowplow
        :type   tracker:        Tracker | None
        N)r.   Úremove_tracker_by_namespacer0   s      r&   Úremove_trackerzSnowplow.remove_trackerx   s    € ð ×)Ñ)Ó+ˆ	Ø×'Ñ'¨	Õ2r(   c                 óª   — | j                   j                  |d«      st        j                  d|z   dz   «       yt        j                  d|z   dz   «       y)zß
        Remove a Snowplow tracker from the Snowplow object using it's namespace if it exists

        :param  namespace:      Tracker namespace to remove from Snowplow
        :type   tracker:        String | None
        Fr*   z' does not existNz' removed from Snowplow)r   Úpopr,   r-   ©r1   r   s     r&   r3   z$Snowplow.remove_tracker_by_namespaceƒ   sK   € ð �}‰}× Ñ  ¨EÔ2Ü�K‰KÐ3°iÑ?ÐBTÑTÔUØÜ�‰Ð/°)Ñ;Ð>WÑWÕXr(   c                 ó   — i | _         y)zN
        Remove all active Snowplow trackers from the Snowplow object
        N)r   )r1   s    r&   ÚresetzSnowplow.reset�   s   € ð
 ˆ�r(   c                 óZ   — || j                   j                  «       v r| j                   |   S y)zô
        Returns a Snowplow tracker from the Snowplow object if it exists
        :param  namespace:              Snowplow tracker namespace
        :type   namespace:              string
        :rtype:                         Tracker
        N)r   r/   r7   s     r&   Úget_trackerzSnowplow.get_tracker—   s+   € ð ˜Ÿ™×*Ñ*Ó,Ñ,Ø—=‘= Ñ+Ð+Ør(   )Ú__name__Ú
__module__Ú__qualname__r   r   Ústrr   Ú__annotations__Ústaticmethodr	   r   r
   r   r   ÚSubjectr'   Úclassmethodr#   r4   r3   r9   r;   © r(   r&   r   r   '   s.  … Ø$&€Iˆt�C˜�LÑ!Ó&àð  Ø $Ø-1Ù/CÓ/EÙ/CÓ/Eñ5-Øð5-àð5-ð ð5-ð ˜‘ð	5-ð
 ˜'Ÿ/™/Ñ*ð5-ð -ð5-ð -ð5-ð 
ò5-ó ð5-ðn ð( 'ð (¨gò (ó ð(ð* ð3 Wò 3ó ð3ð ð
Y°Cò 
Yó ð
Yð ñó ðð ð	 Cð 	¨H°WÑ,=ò 	ó ñ	r(   r   )ÚloggingÚtypingr   r   Úsnowplow_trackerr   r   r   r   r	   Úsnowplow_tracker.typingr
   ÚbasicConfigÚ	getLoggerr<   r,   ÚsetLevelÚINFOr   rD   r(   r&   ú<module>rM      s_   ðó$ ß !÷õ õ +ð €× Ñ Ô Ø	ˆ×	Ñ	˜8Ó	$€Ø ‡��—‘Ô ð÷
zò zr(   