o
    ­Tïj·)  ã                   @   s"  d dl m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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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G dd„ dejƒZdS )é    )Úserializers)ÚgetLanguage)ÚlanguageKeyé   )ÚInteractiveContentÚInteractiveContentSocialMediaÚ%InteractiveContentSocialMediaLanguageÚ$InteractiveContentSocialMediaOptionsÚ,InteractiveContentSocialMediaOptionsLanguageÚ%InteractiveContentSocialMediaHashtagsÚ-InteractiveContentSocialMediaHashtagsLanguageÚInteractiveContentAppContentÚ$InteractiveContentAppContentLanguageÚ#InteractiveContentAppContentOptionsÚ+InteractiveContentAppContentOptionsLanguagec                   @   s:   e Zd Ze ¡ Ze ¡ ZG dd„ dƒZdd„ Zdd„ Z	dS )ÚInteractiveContentSerializerc                   @   ó   e Zd ZeZg d¢ZdS )z!InteractiveContentSerializer.Meta)ÚidÚcontentInformationIdÚsocialMediaListÚappContentListN)Ú__name__Ú
__module__Ú__qualname__r   ÚmodelÚfields© r   r   úˆ/var/www/snowflake_co_dev_github/snow_flake_back_end_deploy/mama_care_api/article/interactive_content/interactive_content_serializers.pyÚMeta   ó    r   c                 C   ó,   t | ƒ}tjj|jd�}t|t|idd�jS ©N)ÚinteractiveContentIdT©ÚcontextÚmany)r   r   ÚobjectsÚfilterr   Ú'InteractiveContentSocialMediaSerializerr   Údata©ÚselfÚinstanceÚ
languageIdÚdataListr   r   r   Úget_socialMediaList!   ó   ÿ
ÿþz0InteractiveContentSerializer.get_socialMediaListc                 C   r    r!   )r   r   r&   r'   r   Ú&InteractiveContentAppContentSerializerr   r)   r*   r   r   r   Úget_appContentList*   r0   z/InteractiveContentSerializer.get_appContentListN)
r   r   r   r   ÚSerializerMethodFieldr   r   r   r/   r2   r   r   r   r   r      s    		r   c                   @   sz   e Zd Ze ¡ Ze ¡ Ze ¡ Ze ¡ Ze ¡ Z	e ¡ Z
G dd„ dƒZdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ ZdS )r(   c                   @   r   )z,InteractiveContentSocialMediaSerializer.Meta)	r   ÚinteractionTyper"   ÚtitleÚquestionÚcaptionÚctaÚ
optionListÚhashtagListN)r   r   r   r   r   r   r   r   r   r   r   <   r   r   c                 C   ó<   t | ƒ}|d urtjj|j|d� ¡ }|d ur|jS d S d S ©N)ÚinteractiveContentSocialMediaIdr-   )r   r   r&   r'   r   Úfirstr5   ©r+   r,   r-   Útranslationr   r   r   Ú	get_titleJ   ó   þýúz1InteractiveContentSocialMediaSerializer.get_titlec                 C   r;   r<   )r   r   r&   r'   r   r>   r6   r?   r   r   r   Úget_questionT   rB   z4InteractiveContentSocialMediaSerializer.get_questionc                 C   r;   r<   )r   r   r&   r'   r   r>   r7   r?   r   r   r   Úget_caption^   rB   z3InteractiveContentSocialMediaSerializer.get_captionc                 C   r;   r<   )r   r   r&   r'   r   r>   r8   r?   r   r   r   Úget_ctah   rB   z/InteractiveContentSocialMediaSerializer.get_ctac                 C   r    ©N)r=   Tr#   )r   r	   r&   r'   r   Ú.InteractiveContentSocialMediaOptionsSerializerr   r)   r*   r   r   r   Úget_optionListr   r0   z6InteractiveContentSocialMediaSerializer.get_optionListc                 C   r    rF   )r   r   r&   r'   r   Ú/InteractiveContentSocialMediaHashtagsSerializerr   r)   r*   r   r   r   Úget_hashtagList{   r0   z7InteractiveContentSocialMediaSerializer.get_hashtagListN)r   r   r   r   r3   r5   r6   r7   r8   r9   r:   r   rA   rC   rD   rE   rH   rJ   r   r   r   r   r(   4   s    



	r(   c                   @   ó   e Zd ZG dd„ dƒZdS )Ú/InteractiveContentSocialMediaLanguageSerializerc                   @   s"   e Zd ZeZddddddegZdS )z4InteractiveContentSocialMediaLanguageSerializer.Metar   r5   r6   r7   r8   r=   N)r   r   r   r   r   r   r   r   r   r   r   r   †   s    ùr   N©r   r   r   r   r   r   r   r   rL   …   ó    rL   c                   @   ó*   e Zd Ze ¡ ZG dd„ dƒZdd„ ZdS )rG   c                   @   r   )z3InteractiveContentSocialMediaOptionsSerializer.Meta©r   ÚkeyNamer=   ÚtextN)r   r   r   r	   r   r   r   r   r   r   r   –   r   r   c                 C   r;   )N)Ú&interactiveContentSocialMediaOptionsIdr-   )r   r
   r&   r'   r   r>   rR   r?   r   r   r   Úget_textŸ   rB   z7InteractiveContentSocialMediaOptionsSerializer.get_textN©r   r   r   r   r3   rR   r   rT   r   r   r   r   rG   “   ó    	rG   c                   @   rK   )Ú6InteractiveContentSocialMediaOptionsLanguageSerializerc                   @   ó   e Zd ZeZdddegZdS )z;InteractiveContentSocialMediaOptionsLanguageSerializer.Metar   rR   rS   N)r   r   r   r
   r   r   r   r   r   r   r   r   «   ó    ür   NrM   r   r   r   r   rW   ª   rN   rW   c                   @   rO   )rI   c                   @   r   )z4InteractiveContentSocialMediaHashtagsSerializer.MetarP   N)r   r   r   r   r   r   r   r   r   r   r   ¸   r   r   c                 C   r;   )N)Ú'interactiveContentSocialMediaHashtagsIdr-   )r   r   r&   r'   r   r>   rR   r?   r   r   r   rT   Á   rB   z8InteractiveContentSocialMediaHashtagsSerializer.get_textNrU   r   r   r   r   rI   µ   rV   rI   c                   @   rK   )Ú7InteractiveContentSocialMediaHashtagsLanguageSerializerc                   @   rX   )z<InteractiveContentSocialMediaHashtagsLanguageSerializer.Metar   rR   rZ   N)r   r   r   r   r   r   r   r   r   r   r   r   Í   rY   r   NrM   r   r   r   r   r[   Ì   rN   r[   c                   @   sZ   e Zd Ze ¡ Ze ¡ Ze ¡ Ze ¡ ZG dd„ dƒZ	dd„ Z
dd„ Zdd„ Zd	d
„ ZdS )r1   c                   @   r   )z+InteractiveContentAppContentSerializer.Meta)r   ÚcorrectAnswerr"   r5   r6   Úexplanationr9   N)r   r   r   r   r   r   r   r   r   r   r   Ý   r   r   c                 C   r;   ©N)ÚinteractiveContentAppContentIdr-   )r   r   r&   r'   r   r>   r5   r?   r   r   r   rA   é   rB   z0InteractiveContentAppContentSerializer.get_titlec                 C   r;   r^   )r   r   r&   r'   r   r>   r6   r?   r   r   r   rC   ó   rB   z3InteractiveContentAppContentSerializer.get_questionc                 C   r;   r^   )r   r   r&   r'   r   r>   r]   r?   r   r   r   Úget_explanationý   rB   z6InteractiveContentAppContentSerializer.get_explanationc                 C   r    )N)r_   Tr#   )r   r   r&   r'   r   Ú-InteractiveContentAppContentOptionsSerializerr   r)   r*   r   r   r   rH     r0   z5InteractiveContentAppContentSerializer.get_optionListN)r   r   r   r   r3   r5   r6   r]   r9   r   rA   rC   r`   rH   r   r   r   r   r1   ×   s    


r1   c                   @   rK   )Ú.InteractiveContentAppContentLanguageSerializerc                   @   s    e Zd ZeZdddddegZdS )z3InteractiveContentAppContentLanguageSerializer.Metar   r5   r6   r]   r_   N)r   r   r   r   r   r   r   r   r   r   r   r     s    úr   NrM   r   r   r   r   rb     rN   rb   c                   @   rO   )ra   c                   @   r   )z2InteractiveContentAppContentOptionsSerializer.Meta)r   rQ   r_   rR   N)r   r   r   r   r   r   r   r   r   r   r   !  r   r   c                 C   r;   )N)Ú%interactiveContentAppContentOptionsIdr-   )r   r   r&   r'   r   r>   rR   r?   r   r   r   rT   *  rB   z6InteractiveContentAppContentOptionsSerializer.get_textNrU   r   r   r   r   ra     rV   ra   c                   @   rK   )Ú5InteractiveContentAppContentOptionsLanguageSerializerc                   @   rX   )z:InteractiveContentAppContentOptionsLanguageSerializer.Metar   rR   rc   N)r   r   r   r   r   r   r   r   r   r   r   r   6  rY   r   NrM   r   r   r   r   rd   5  rN   rd   N)Úrest_frameworkr   Úcommon.commonr   Úmama_care_api.settingsr   Úinteractive_content_modelsr   r   r   r	   r
   r   r   r   r   r   r   ÚModelSerializerr   r(   rL   rG   rW   rI   r[   r1   rb   ra   rd   r   r   r   r   Ú<module>   s    4 Q: