Ë
    ÌiÕ#  ã                  óÈ   — U d dl mZ d dlZd dlmZ d dlmZ d dlmZmZm	Z	m
Z
mZmZmZ ddlmZmZ ddlmZ dd	lmZ d
gZ e«       Zded<    ed«      Z G d„ d
ee   «      Zy)é    )ÚannotationsN)Ú	b64decode)Údatetime)ÚcastÚUnionÚAnyÚOptionalÚDictÚTypeVarÚGenericé   )Ú_convert_to_isoformatÚTZ_UTC)Ú_get_json_content)ÚNULLÚ
CloudEventr   Ú_UnsetÚDataTypec            	      ó  — e Zd ZU dZded<   	 ded<   	 dZded<   	 ded<   	 ded	<   	 d
ed<   	 ded<   	 ded<   	 ded<   	 ded<   	 ddeddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zdd„Ze	dd„«       Z
e	dd„«       Zy)r   a²  Properties of the CloudEvent 1.0 Schema.
    All required parameters must be populated in order to send to Azure.

    :param source: Required. Identifies the context in which an event happened. The combination of id and source must
     be unique for each distinct event. If publishing to a domain topic, source must be the domain topic name.
    :type source: str
    :param type: Required. Type of event related to the originating occurrence.
    :type type: str
    :keyword specversion: Optional. The version of the CloudEvent spec. Defaults to "1.0"
    :paramtype specversion: str
    :keyword data: Optional. Event data specific to the event type.
    :paramtype data: object
    :keyword time: Optional. The time (in UTC) the event was generated.
    :paramtype time: ~datetime.datetime
    :keyword dataschema: Optional. Identifies the schema that data adheres to.
    :paramtype dataschema: str
    :keyword datacontenttype: Optional. Content type of data value.
    :paramtype datacontenttype: str
    :keyword subject: Optional. This describes the subject of the event in the context of the event producer
     (identified by source).
    :paramtype subject: str
    :keyword id: Optional. An identifier for the event. The combination of id and source must be
     unique for each distinct event. If not provided, a random UUID will be generated and used.
    :paramtype id: Optional[str]
    :keyword extensions: Optional. A CloudEvent MAY include any number of additional context attributes
     with distinct names represented as key - value pairs. Each extension must be alphanumeric, lower cased
     and must not exceed the length of 20 characters.
    :paramtype extensions: Optional[dict]
    ÚstrÚsourceÚtypez1.0ÚspecversionÚidúOptional[DataType]ÚdataúOptional[datetime]ÚtimeúOptional[str]Ú
dataschemaÚdatacontenttypeÚsubjectúOptional[Dict[str, Any]]Ú
extensionsN)r   r   r   r!   r    r"   r   r$   c               ó6  — || _         || _        |r|| _        |r|nt        t	        j
                  «       «      | _        |  |t        u rt        j                  t        «      | _        n|| _        || _        || _        || _        |	| _        |
| _        | j                   rJ| j                   j#                  «       D ]-  }|j%                  «       r|j'                  «       rŒ$t)        d«      ‚ |r1dj+                  |j#                  «       «      }t)        d|› d�dz   «      ‚y )Nz<Extension attributes should be lower cased and alphanumeric.z, zUnexpected keyword arguments z. zDAny extension attributes must be passed explicitly using extensions.)r   r   r   r   ÚuuidÚuuid4r   r   r   Únowr   r   r!   r    r"   r   r$   ÚkeysÚislowerÚisalnumÚ
ValueErrorÚjoin)Úselfr   r   r   r   r   r!   r    r"   r   r$   ÚkwargsÚkeyÚ	remainings                 úU/var/www/html/strategist-ai/venv/lib/python3.12/site-packages/azure/core/messaging.pyÚ__init__zCloudEvent.__init__[   sú   € ð "ˆŒØˆŒ	áØ$/ˆDÔÙ‘r¤S¬¯©«Ó%6ˆŒáØ”6‰>Ü Ÿ™¤VÓ,ˆD�IàˆDŒIà.=ˆÔØ)3ˆŒØ&-ˆŒØ(,ˆŒ	à4>ˆŒØ�?Š?Ø—‘×+Ñ+Ó-ò e�Ø—{‘{”}¨C¯K©K­MÜ$Ð%cÓdÐdðeñ ØŸ	™	 &§+¡+£-Ó0ˆIÜØ/°	¨{¸"Ð=ØXñYóð ð ó    c                ó–   — dj                  | j                  | j                  | j                  | j                  | j
                  «      d d S )Nz>CloudEvent(source={}, type={}, specversion={}, id={}, time={})i   )Úformatr   r   r   r   r   )r.   s    r2   Ú__repr__zCloudEvent.__repr__‰   s@   € ØO×VÑVØ�K‰K˜Ÿ™ D×$4Ñ$4°d·g±g¸t¿y¹yó
à
ˆ4ðð 	r4   c                óÆ  ‡— i }g d¢}d‰v rd‰v rt        d«      ‚d‰v r‰j                  d«      }|�|nt        |d<   n<d‰v r8t        t	        t
        t        t        f   ‰j                  d«      «      «      |d<   dD ]%  }|‰v sŒ‰j                  |«      }|�|nt        ||<   Œ' ‰j                  «       D ��ci c]  \  }}||vsŒ||“Œ }	}}|	r|	|d<   	  | d‰j                  d«      ‰d	   ‰d
   ‰j                  d«      t        ‰j                  d«      «      dœ|¤Ž}
|
S c c}}w # t        $ r1}t        ˆfd„dD «       «      rt        d«      |‚t        d«      |‚d}~ww xY w)a  Returns the deserialized CloudEvent object when a dict is provided.

        :param event: The dict representation of the event which needs to be deserialized.
        :type event: dict
        :rtype: CloudEvent
        :return: The deserialized CloudEvent object.
        )
r   Údata_base64r   r   r   r   r   r    r!   r"   r   r9   z@Invalid input. Only one of data and data_base64 must be present.N)r!   r    r"   r$   r   r   r   r   r   )r   r   r   r   r   c              3  ó&   •K  — | ]  }|‰v –— Œ
 y ­w)N© )Ú.0r0   Úevents     €r2   ú	<genexpr>z'CloudEvent.from_dict.<locals>.<genexpr>Ä   s   øè ø€ ò 
àð �u”ñ
ùs   ƒ)r"   Ú	eventTyper   ÚdataVersionr   Ú	eventTimez¤The event you are trying to parse follows the Eventgrid Schema. You can parse EventGrid events using EventGridEvent.from_dict method in the azure-eventgrid library.z„The event does not conform to the cloud event spec https://github.com/cloudevents/spec. The `source` and `type` params are required.r;   )r,   Úgetr   r   r   r   r   ÚbytesÚitemsr   ÚKeyErrorÚall)Úclsr=   r/   Úreserved_attrr   ÚitemÚvalÚkÚvr$   Ú	event_objÚerrs    `          r2   Ú	from_dictzCloudEvent.from_dictŽ   s®  ø€ ð "$ˆò
ˆð �U‰?˜}°Ñ5ÜÐ_Ó`Ð`à�U‰?Ø—9‘9˜VÓ$ˆDØ%)Ð%5™T¼4ˆF�6ŠNØ˜eÑ#Ü&¤t¬E´#´u°*Ñ,=¸u¿y¹yÈÓ?WÓ'XÓYˆF�6‰Nà@ò 	@ˆDØ�uŠ}Ø—i‘i “o�Ø&) o™s¼4��t’ð	@ð
 (-§{¡{£}×O™t˜q !¸ÀÒ8N�a˜‘dÐOˆ
ÑOÙØ#-ˆF�<Ñ ð	Ùð Ø—9‘9˜T“?Ø˜X‘Ø˜6‘]Ø!ŸI™I mÓ4Ü*¨5¯9©9°VÓ+<Ó=ñð ñˆIð> ÐùóI Pøô ò 	ô ó 
ðô
ô 
ô !ðpóð ðô ðBóð ðûð'	ús%   Â7D ÃD ÃA
D& Ä&	E Ä/,EÅE c                óB   — t        |«      }t        j                  |«      S )a¬  Returns the deserialized CloudEvent object when a json payload is provided.

        :param event: The json string that should be converted into a CloudEvent. This can also be
         a storage QueueMessage, eventhub's EventData or ServiceBusMessage
        :type event: object
        :rtype: CloudEvent
        :return: The deserialized CloudEvent object.
        :raises ValueError: If the provided JSON is invalid.
        )r   r   rO   )rG   r=   Ú
dict_events      r2   Ú	from_jsonzCloudEvent.from_jsonÙ   s   € ô ' uÓ-ˆ
Ü×#Ñ# JÓ/Ð/r4   )r   r   r   r   r   r   r   r   r   r   r!   r   r    r   r"   r   r   r   r$   r#   r/   r   ÚreturnÚNone)rS   r   )r=   zDict[str, Any]rS   úCloudEvent[DataType])r=   r   rS   rU   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   r   r3   r7   ÚclassmethodrO   rR   r;   r4   r2   r   r      s:  … ñð< ƒKðtð ƒIØ>à€K�ÓØ@àƒGðeð ÓØ0à
ÓØ4àÓØ5à"Ó"Ø%àÓð!ð )Ó(ð;ð &*Ø Ø#)Ø)-Ø$(Ø!%Ø#'Ø/3ñ,àð,ð ð,ð
 #ð,ð ð,ð !ð,ð 'ð,ð "ð,ð ð,ð !ð,ð -ð,ð ð,ð 
ó,ó\ð
 òHó ðHðT ò0ó ñ0r4   )Ú
__future__r   r&   Úbase64r   r   Útypingr   r   r   r	   r
   r   r   Úutils._utilsr   r   Úutils._messaging_sharedr   Úserializationr   Ú__all__Úobjectr   rZ   r   r   r;   r4   r2   ú<module>rd      sY   ðö #Û Ý Ý ß E× EÑ Eß 7Ý 6Ý ð ˆ.€ñ ‹h€ˆÓ á�:Ó€ôL0�˜Ñ"õ L0r4   