Ë
    ÌiÂ  ã                   ó~   — d dl mZmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ  G d	„ d
e«      Zy)é    )ÚOptionalÚList)ÚJsonEncoderFunction)ÚEvent)ÚSelfDescribingJson)ÚUNSTRUCT_EVENT_SCHEMA)Úpayload)ÚSubject)Ú	non_emptyc                   óÄ   ‡ — e Zd ZdZ	 	 	 ddedee   deee      dee   ddf
ˆ fd„Z	e
defd	„«       Zej                  d
efd„«       Z	 ddedee   dee   ddfˆ fd„Zˆ xZS )ÚSelfDescribingzæ
    Constructs a SelfDescribing event object.

    This is a customisable event type which allows you to track anything describable
    by a JsonSchema.

    When tracked, generates a self-describing event (event type "ue").
    NÚ
event_jsonÚevent_subjectÚcontextÚtrue_timestampÚreturnc                 óx   •— t         t        | �  |||¬«       | j                  j	                  dd«       || _        y)a»  
        :param  event_json:      The properties of the event. Has two field:
                                 A "data" field containing the event properties and
                                 A "schema" field identifying the schema against which the data is validated
        :type   event_json:      self_describing_json
        :param  event_subject:   Optional per event subject
        :type   event_subject:   subject | None
        :param  context:         Custom context for the event
        :type   context:         context_array | None
        :param  true_timestamp:          Optional event timestamp in milliseconds
        :type   true_timestamp:          int | float | None
        )r   r   r   ÚeÚueN)Úsuperr   Ú__init__r	   Úaddr   )Úselfr   r   r   r   Ú	__class__s        €úh/var/www/html/strategist-ai/venv/lib/python3.12/site-packages/snowplow_tracker/events/self_describing.pyr   zSelfDescribing.__init__%   s=   ø€ ô& 	Œn˜dÑ,Ø'°Èð 	-ô 	
ð 	�‰×Ñ˜˜dÔ#Ø$ˆ�ó    c                 ó   — | j                   S )zÔ
        The properties of the event. Has two field:
            A "data" field containing the event properties and
            A "schema" field identifying the schema against which the data is validated
        ©Ú_event_json)r   s    r   r   zSelfDescribing.event_json>   s   € ð ×ÑÐr   Úvaluec                 ó   — || _         y ©Nr   )r   r    s     r   r   zSelfDescribing.event_jsonG   s
   € à ˆÕr   Úencode_base64Újson_encoderÚsubjectzpayload.Payloadc                 óÚ   •— t        t        | j                  j                  «       «      j                  «       }| j                  j                  ||dd|«       t        t        | �#  |||¬«      S )a¹  
        :param encode_base64:    Whether JSONs in the payload should be base-64 encoded
        :type  encode_base64:    bool
        :param json_encoder:     Custom JSON serializer that gets called on non-serializable object
        :type  json_encoder:     function | None
        :param  subject:         Optional per event subject
        :type   subject:         subject | None
        :rtype:                  payload.Payload
        Úue_pxÚue_pr)r#   r$   r%   )	r   r   r   Úto_jsonr	   Úadd_jsonr   r   Úbuild_payload)r   r#   r$   r%   Úenveloper   s        €r   r+   zSelfDescribing.build_payloadK   sg   ø€ ô  &Ü! 4§?¡?×#:Ñ#:Ó#<ó
ç
‰'‹)ð 	ð 	�‰×Ñ˜h¨°wÀÈÔVä”^ TÑ8Ø'°lÈGð 9ó 
ð 	
r   )NNNr"   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r
   r   Úfloatr   Úpropertyr   ÚsetterÚboolr   r+   Ú__classcell__)r   s   @r   r   r      sÚ   ø„ ñð ,0Ø6:Ø*.ñ%à&ð%ð   Ñ(ð%ð ˜$Ð1Ñ2Ñ3ð	%ð
 ! ™ð%ð 
õ%ð2 ð Ð.ò  ó ð ð ×Ñð!Ð 2ò !ó ð!ð &*ñ	
àð
ð Ð2Ñ3ð
ð ˜'Ñ"ð	
ð
 
÷
ñ 
r   r   N)Útypingr   r   Úsnowplow_tracker.typingr   Úsnowplow_tracker.events.eventr   Úsnowplow_trackerr   Úsnowplow_tracker.constantsr   r	   Úsnowplow_tracker.subjectr
   Úsnowplow_tracker.contractsr   r   © r   r   ú<module>r>      s-   ð÷" "Ý 7Ý /Ý /Ý <Ý $Ý ,Ý 0ôG
�Uõ G
r   