o
    fsi.                     @   s   d dl mZ ddlmZmZmZmZ G dd dejZG dd dejZ	G dd	 d	ejZ
G d
d dejZG dd dejZdS )    )serializers   )FeedbackEventFeedbackCategoryFeedbackFeedbackConfigurationc                   @   s"   e Zd Ze ZG dd dZdS )FeedbackEventSerializerc                   @   s    e Zd ZeZg dZg dZdS )zFeedbackEventSerializer.Meta)idnameslugdescription	is_activeis_stats_publishedis_archivedarchived_atfeedback_count
created_at
updated_at)r   r   r   r   N)__name__
__module____qualname__r   modelfieldsread_only_fields r   r   @/var/www/html/smartRegister/backend/apps/feedback/serializers.pyMeta   s    r   N)r   r   r   r   ReadOnlyFieldr   r   r   r   r   r   r      s    r   c                   @   s   e Zd ZG dd dZdS )FeedbackCategorySerializerc                   @      e Zd ZeZg dZdS )zFeedbackCategorySerializer.Meta)r	   r
   r   r   r   N)r   r   r   r   r   r   r   r   r   r   r          r   N)r   r   r   r   r   r   r   r   r      s    r   c                   @   sD   e Zd ZejdddZejdddZejdddZG dd dZdS )	FeedbackSerializerzfeedback_event.nameTsource	read_onlyzcategory.nameget_rating_displayc                   @   s    e Zd ZeZg dZddgZdS )zFeedbackSerializer.Meta)r	   feedback_event
event_namecategorycategory_nameratingrating_displaycommentr
   emailregistration_codeis_anonymous
ip_addressis_publishedr   r0   r   N)r   r   r   r   r   r   r   r   r   r   r   r      s    r   N)	r   r   r   r   	CharFieldr'   r)   r+   r   r   r   r   r   r!      s
    r!   c                   @   s.   e Zd ZdZG dd dZdd Zdd ZdS )	PublicFeedbackSerializerz*Serializer for public feedback submission.c                   @   r   )zPublicFeedbackSerializer.Meta)r&   r(   r*   r,   r
   r-   r.   r/   N)r   r   r   r   r   r   r   r   r   r   r   '   r    r   c                 C   s2   |j r|jrtdt }|jstd|S )Nz,This feedback event is not currently active.z*Feedback collection is currently disabled.)r   r   r   ValidationErrorr   
get_configfeedback_enabled)selfeventconfigr   r   r   validate_feedback_event+   s   

z0PublicFeedbackSerializer.validate_feedback_eventc                 C   s6   | ds| ds| ds| dstd|S )Nr/   r
   r-   r.   zMPlease provide your name, email, or registration code, or submit anonymously.)getr   r4   )r7   datar   r   r   validate3   s   

z!PublicFeedbackSerializer.validateN)r   r   r   __doc__r   r:   r=   r   r   r   r   r3   $   s
    r3   c                   @   s(   e Zd ZejdddZG dd dZdS )FeedbackConfigSerializerzactive_event.nameTr"   c                   @   s   e Zd ZeZg dZdgZdS )zFeedbackConfigSerializer.Meta)r	   active_eventactive_event_namer6   welcome_messagethank_you_messagedisabled_messager   r   N)r   r   r   r   r   r   r   r   r   r   r   r   =   s    
r   N)r   r   r   r   r2   rA   r   r   r   r   r   r?   :   s    r?   N)rest_frameworkr   modelsr   r   r   r   ModelSerializerr   r   r!   r3   r?   r   r   r   r   <module>   s    	