
    >Tf	                         d dl mZ d dlmZ d dlmZ d dlmZ d dlT d dl	m
Z
mZ d dlmZmZ d dlmZ d d	lmZ d
dlmZ dZ G d de          Z G d de          ZdS )    )OpenApiTypes)extend_schema_field)serializers)
ObjectType)*)	EventRuleWebhook)ChoiceFieldContentTypeField)NetBoxModelSerializer)get_serializer_for_model   )ScriptSerializer)EventRuleSerializerWebhookSerializerc                   &   e Zd Z eej                            d          d          Z ee	          Z
 eej                            d                    Z ej        d          Z G d d          Z eej                  d	             Zd
S )r   event_rulesT)querysetmany)choices)r   )	read_onlyc                       e Zd ZeZg dZdZdS )EventRuleSerializer.Meta)idurldisplay_urldisplayobject_typesnameenabledevent_types
conditionsaction_typeaction_object_typeaction_object_idaction_objectdescriptioncustom_fieldstagscreatedlast_updatedr   r   r   r   r'   N)__name__
__module____qualname__r   modelfieldsbrief_fields     C/var/www/html/netbox-4.1.3/netbox/extras/api/serializers_/events.pyMetar   "   s,        
 
 

 Gr4   r6   c                    d| j         d         i}|j        t          j        k    r|j        }t          |d|          j        S t          |j        	                                          } ||j        d|          j        S )NrequestT)nestedcontext)
r:   r#   EventRuleActionChoicesSCRIPTr&   r   datar   r$   model_class)selfinstancer:   script
serializers        r5   get_action_objectz%EventRuleSerializer.get_action_object+   s~    dl956#9#@@@+F#F4IIINN1(2M2Y2Y2[2[\\J:h4T7SSSXXr4   N)r-   r.   r/   r   r   objectswith_featurer   r
   r;   r#   r$   r   SerializerMethodFieldr&   r6   r   r   OBJECTrC   r3   r4   r5   r   r      s        ###00??  L +&<===K))#00??   6K5EEEMG G G G G G G G ,--Y Y .-Y Y Yr4   r   c                   (    e Zd Z G d d          ZdS )r   c                       e Zd ZeZg dZdZdS )WebhookSerializer.Meta)r   r   r   r   r   r'   payload_urlhttp_methodhttp_content_typeadditional_headersbody_templatesecretssl_verificationca_file_pathr(   r)   r*   r+   r,   N)r-   r.   r/   r	   r0   r1   r2   r3   r4   r5   r6   rJ   =   s,        
 
 

 Gr4   r6   N)r-   r.   r/   r6   r3   r4   r5   r   r   ;   sF        G G G G G G G G G Gr4   r   N)drf_spectacular.typesr   drf_spectacular.utilsr   rest_frameworkr   core.modelsr   extras.choicesextras.modelsr   r	   netbox.api.fieldsr
   r   netbox.api.serializersr   utilities.apir   scriptsr   __all__r   r   r3   r4   r5   <module>r^      s9   . . . . . . 5 5 5 5 5 5 & & & & & & " " " " " "     , , , , , , , , ; ; ; ; ; ; ; ; 8 8 8 8 8 8 2 2 2 2 2 2 % % % % % %Y Y Y Y Y/ Y Y YH	G 	G 	G 	G 	G- 	G 	G 	G 	G 	Gr4   