
    6]hc	                     $   d dl mZ ddlmZmZmZmZ  G d dej                        Z G d dej                        Z	 G d d	ej                        Z
 G d
 dej                        Z G d dej                        Z G d dej                        Zy)    )serializers   )NotificationNotificationCategoryNotificationTagSiteStatisticc                        e Zd Z G d d      Zy)NotificationCategorySerializerc                       e Zd ZeZg dZy)#NotificationCategorySerializer.Meta)idnamedescription
color_codeN)__name__
__module____qualname__r   modelfields     ./var/www/apihucms/notifications/serializers.pyMetar      s    $<r   r   Nr   r   r   r   r   r   r   r
   r
      s    = =r   r
   c                        e Zd Z G d d      Zy)NotificationTagSerializerc                       e Zd ZeZddgZy)NotificationTagSerializer.Metar   r   N)r   r   r   r   r   r   r   r   r   r   r      s    r   r   Nr   r   r   r   r   r      s       r   r   c                       e Zd ZdZ ed      Z ej                         Z ej                         Z	 G d d      Z
d Zd Zy)	NotificationListSerializerz3Serializer for listing notifications (minimal data)T	read_onlyc                       e Zd ZeZg dZy)NotificationListSerializer.Meta)
r   titler   slugpublished_datedatecategorypriorityis_featuredtagsNr   r   r   r   r   r   r   r   r   r   r$      s    
r   r   c                     |j                   j                         D cg c]  }|j                  j                   c}S c c}w N)notification_tagsalltagr   selfobjr2   s      r   get_tagsz#NotificationListSerializer.get_tags   s-    (+(=(=(A(A(CDDDDs   =c                     |j                   S r/   formatted_dater4   r5   s     r   get_datez#NotificationListSerializer.get_date!       !!!r   Nr   r   r   __doc__r
   r)   r   SerializerMethodFieldr,   r(   r   r6   r;   r   r   r   r    r       sD    =-=H,;,,.D,;,,.D
 
E"r   r    c                       e Zd ZdZ ed      Z ej                         Z ej                         Z	 G d d      Z
d Zd Zy)	NotificationDetailSerializerz)Serializer for detailed notification viewTr!   c                       e Zd ZeZg dZy)!NotificationDetailSerializer.Meta)r   r%   r   contentr&   r'   r(   r)   r*   r+   external_link
attachmentmeta_descriptionr,   
created_at
updated_atNr-   r   r   r   r   rC   +   s    
r   r   c                     t        |j                  j                         D cg c]  }|j                   c}d      j                  S c c}w )NTmany)r   r0   r1   r2   datar3   s      r   r6   z%NotificationDetailSerializer.get_tags4   s7    (S=R=R=V=V=X)Yc#'')Y`dejjj)Ys   Ac                     |j                   S r/   r8   r:   s     r   r;   z%NotificationDetailSerializer.get_date7   r<   r   Nr=   r   r   r   rA   rA   %   sD    3-=H,;,,.D,;,,.D
 
k"r   rA   c                        e Zd Z G d d      Zy)SiteStatisticSerializerc                       e Zd ZeZg dZy)SiteStatisticSerializer.Meta)r   r   valuer   iconorderN)r   r   r   r   r   r   r   r   r   r   rR   <   s    Hr   r   Nr   r   r   r   rP   rP   ;   s    I Ir   rP   c                   V    e Zd ZdZ ed      Z ed      Z ej                         Z
y)#NotificationStatsResponseSerializerz8Combined response serializer for notifications and statsTrK   N)r   r   r   r>   r    notificationsrP   
statisticsr   	DictField
paginationr   r   r   rW   rW   A   s)    B.D9M(d3J&&&(Jr   rW   N)rest_frameworkr   modelsr   r   r   r   ModelSerializerr
   r   r    rA   rP   
SerializerrW   r   r   r   <module>r`      s|    & V V=[%@%@ =  ; ;  "!<!< "(";#>#> ",Ik99 I)+*@*@ )r   