Ë
    Ìi  ã                   óŒ   — d dl mZmZmZmZmZ d dlmZmZm	Z	 d dl
mZmZ d dlmZmZmZmZmZmZmZ  G d„ dee   ee   «      Zy)é    )ÚDictÚGenericÚListÚSequenceÚSet)ÚEntityÚSemanticManifestTÚSemanticModel)ÚEntityReferenceÚSemanticModelElementReference)ÚFileContextÚSemanticManifestValidationRuleÚSemanticModelElementContextÚSemanticModelElementTypeÚValidationIssueÚValidationWarningÚvalidate_safelyc                   óÈ   — e Zd ZdZedee   deee	e
   f   fd„«       Ze ed¬«      deded	eee	e
   f   dee   fd
„«       «       Ze ed¬«      dedee   fd„«       «       Zy)ÚCommonEntitysRulez;Checks that entities exist on more than one semantic model.Úsemantic_modelsÚreturnc                 óì   — i }| xs g D ]h  }|j                   xs g D ]S  }|j                  |v r)||j                     j                  |j                  «       Œ:|j                  h||j                  <   ŒU Œj |S )zSGenerate mapping of entity names to the set of semantic_models where it is defined.)ÚentitiesÚ	referenceÚaddÚname)r   Úentities_to_semantic_modelsÚsemantic_modelÚentitys       út/var/www/html/strategist-ai/venv/lib/python3.12/site-packages/dbt_semantic_interfaces/validations/common_entities.pyÚ_map_semantic_model_entitiesz.CommonEntitysRule._map_semantic_model_entities   sŽ   € ð HJÐ#Ø-Ò3°ò 	ZˆNØ(×1Ñ1Ò7°Rò Z�Ø×#Ñ#Ð'BÑBØ/°×0@Ñ0@ÑA×EÑEÀn×FYÑFYÕZàES×EXÑEXÐDYÐ/°×0@Ñ0@ÒAñ	Zð	Zð +Ð*ó    z6checking entity exists on more than one semantic model)Úwhats_being_doner   r   r   c                 óÀ  — g }| j                   |v rÍt        || j                      j                  |j                  h«      «      dk(  r˜|j	                  t        t        t        j                  |j                  ¬«      t        |j                  | j                  ¬«      t        j                  ¬«      d| j                   j                  › d|j                  › d�¬«      «       |S )	Nr   )Úmetadata)Úsemantic_model_nameÚelement_name)Úfile_contextÚsemantic_model_elementÚelement_typezEntity `z$` only found in one semantic model `z)` which means it will be unused in joins.)ÚcontextÚmessage)r   ÚlenÚ
differencer   Úappendr   r   r   Úfrom_metadatar%   r   r   ÚENTITYr'   )r   r   r   Úissuess       r    Ú_check_entityzCommonEntitysRule._check_entity"   s×   € ð )+ˆð ×ÑÐ ;Ñ;ÜÐ/°×0@Ñ0@ÑA×LÑLÈn×NaÑNaÐMbÓcÓdÐhiÒià�M‰MÜ!Ü7Ü%0×%>Ñ%>È×H_ÑH_Ô%`Ü/LØ0>×0CÑ0CÐRX×R]ÑR]ô0ô &>×%DÑ%Dôð ' v×'7Ñ'7×'DÑ'DÐ&Eð F9Ø9G×9LÑ9LÐ8Mð N>ð?ôôð ˆr"   zLrunning model validation warning if entities are only one one semantic modelÚsemantic_manifestc           	      óê   — g }t         j                  | j                  «      }| j                  xs g D ]>  }|j                  xs g D ])  }|j	                  t         j                  |||¬«      «       Œ+ Œ@ |S )zPIssues a warning for any entity that is associated with only one semantic_model.)r   r   r   )r   r!   r   r   Úextendr3   )r4   r2   r   r   r   s        r    Úvalidate_manifestz#CommonEntitysRule.validate_manifest@   s„   € ð )+ˆä&7×&TÑ&TÐUf×UvÑUvÓ&wÐ#Ø/×?Ñ?ÒEÀ2ò 	ˆNØ(×1Ñ1Ò7°Rò �Ø—‘Ü%×3Ñ3Ø%Ø'5Ø4Oð 4ó õñð	ð ˆr"   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústaticmethodr   r
   r   r   r   Ústrr!   r   r   r   r3   r	   r7   © r"   r    r   r      sÎ   „ ÙEàð	+°h¸}Ñ6Mð 	+ÐRVÐWfÐhkÐloÑhpÐWpÑRqò 	+ó ð	+ð ÙÐ&^Ô_ðØðà%ðð &*¨/¸3¸s¹8Ð*CÑ%Dðð 
�/Ñ	"ò	ó `ó ðð8 ÙÐ&tÔuðÐ->ð À8ÈOÑC\ò ó vó ñr"   r   N)Útypingr   r   r   r   r   Ú!dbt_semantic_interfaces.protocolsr   r	   r
   Ú"dbt_semantic_interfaces.referencesr   r   Ú5dbt_semantic_interfaces.validations.validator_helpersr   r   r   r   r   r   r   r   r>   r"   r    ú<module>rC      s@   ðß 5Õ 5ç VÑ V÷÷÷ ñ ô>Ð6Ð7HÑIÈ7ÐSdÑKeõ >r"   