Ë
    èlÖi  ã                   óH   — d dl Z d dlZd dlmZmZ d dlmZmZ  G d„ d«      Zy)é    N)ÚAnyÚOptional)ÚPayloadDictÚJsonEncoderFunctionc                   óŒ   — e Zd Zddee   ddfd„Z	 dededdfd„Zddede	ddfd	„Z
	 ddee   d
e	dededee   ddfd„Zdefd„Zy)ÚPayloadNÚdict_Úreturnc                 óJ   — i | _         |�|D ]  }||   | j                   |<   Œ yy)z
        Constructor
        N©Únv_pairs)Úselfr	   Úfs      ú]/var/www/html/strategist-ai/venv_dbt/lib/python3.12/site-packages/snowplow_tracker/payload.pyÚ__init__zPayload.__init__   s7   € ð
 ˆŒàÐØò ,�Ø#(¨¡8�—‘˜aÒ ñ,ð ó    ÚnameÚvaluec                 ó4   — |dk(  s|�|| j                   |<   yyy)z=
        Add a name value pair to the Payload object
        Ú Nr   )r   r   r   s      r   ÚaddzPayload.add(   s$   € ð ˜’˜u˜}Ø"'ˆD�M‰M˜$Òð  -�r   Úbase64c                 ó<   — |D ]  }| j                  |||   «       Œ y)z½
        Add a dict of name value pairs to the Payload object

        :param  dict_:          Dictionary to be added to the Payload
        :type   dict_:          dict(string:\*)
        N)r   )r   r	   r   r   s       r   Úadd_dictzPayload.add_dict/   s%   € ð ò 	"ˆAØ�H‰H�Q˜˜a™Õ!ñ	"r   Úencode_base64Útype_when_encodedÚtype_when_not_encodedÚjson_encoderc                 óþ   — |�{|i k7  rut        j                  |d|¬«      }|rHt        j                  |j	                  d«      «      }|j                  d«      }| j                  ||«       y| j                  ||«       yyy)aé  
        Add an encoded or unencoded JSON to the payload

        :param  dict_:                  Custom context for the event
        :type   dict_:                  dict(string:\*) | None
        :param  encode_base64:          If the payload is base64 encoded
        :type   encode_base64:          bool
        :param  type_when_encoded:      Name of the field when encode_base64 is set
        :type   type_when_encoded:      string
        :param  type_when_not_encoded:  Name of the field when encode_base64 is not set
        :type   type_when_not_encoded:  string
        :param json_encoder:            Custom JSON serializer that gets called on non-serializable object
        :type  json_encoder:            function | None
        NF)Úensure_asciiÚdefaultzutf-8)ÚjsonÚdumpsr   Úurlsafe_b64encodeÚencodeÚdecoder   )	r   r	   r   r   r   r   Ú	json_dictÚencoded_dictÚencoded_dict_strs	            r   Úadd_jsonzPayload.add_json9   sz   € ð. Ð ¨"¢äŸ
™
 5°uÀlÔSˆIáÜ%×7Ñ7¸	×8HÑ8HÈÓ8QÓR�Ø#/×#6Ñ#6°wÓ#?Ð Ø—‘Ð*Ð,<Õ=ð —‘Ð.°	Õ:ð "-Ðr   c                 ó   — | j                   S )zH
        Returns the context dictionary from the Payload object
        r   )r   s    r   ÚgetzPayload.get\   s   € ð �}‰}Ðr   )N)F)Ú__name__Ú
__module__Ú__qualname__r   r   r   Ústrr   r   Úboolr   r   r*   r,   © r   r   r   r      s¯   „ ñ	,˜h {Ñ3ð 	,¸tó 	,ðð(˜ð ( Cð (¨Dó (ñ"˜kð "°4ð "ÀDó "ð  7;ñ!;à˜Ñ$ð!;ð ð!;ð ð	!;ð
  #ð!;ð Ð2Ñ3ð!;ð 
ó!;ðF�[ô r   r   )	r"   r   Útypingr   r   Úsnowplow_tracker.typingr   r   r   r2   r   r   ú<module>r5      s   ðó$ Û ß  ß D÷Hò Hr   