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 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é   )ÚStoryContentÚStoryContentSocialMediaÚStoryContentSocialMediaLanguageÚStoryContentSocialMediaHashtagsÚ'StoryContentSocialMediaHashtagsLanguageÚStoryContentAppContentÚStoryContentAppContentLanguagec                   @   s:   e Zd Ze ¡ Ze ¡ ZG dd„ dƒZdd„ Zdd„ Z	dS )ÚStoryContentSerializerc                   @   ó   e Zd ZeZg d¢ZdS )zStoryContentSerializer.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/story_content/story_content_serializers.pyÚMeta   ó    r   c                 C   ó,   t | ƒ}tjj|jd�}t|t|idd�jS ©N)ÚstoryContentIdT©ÚcontextÚmany)r   r   ÚobjectsÚfilterr   Ú!StoryContentSocialMediaSerializerr   Údata©ÚselfÚinstanceÚ
languageIdÚdataListr   r   r   Úget_socialMediaList   ó   ÿ
ÿþz*StoryContentSerializer.get_socialMediaListc                 C   r   r   )r   r   r"   r#   r   Ú StoryContentAppContentSerializerr   r%   r&   r   r   r   Úget_appContentList&   r,   z)StoryContentSerializer.get_appContentListN)
r   r   r   r   ÚSerializerMethodFieldr   r   r   r+   r.   r   r   r   r   r      s    		r   c                   @   sŠ   e Zd Ze ¡ 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d„ ZdS )r$   c                   @   r   )z&StoryContentSocialMediaSerializer.Meta)	r   r   Ú
storyTitleÚstoryOpeningÚstoryDevelopmentÚstoryResolutionÚcaptionÚctaÚhashtagListN)r   r   r   r   r   r   r   r   r   r   r   9   r   r   c                 C   ó<   t | ƒ}|d urtjj|j|d� ¡ }|d ur|jS d S d S ©N)ÚstoryContentSocialMediaIdr)   )r   r   r"   r#   r   Úfirstr0   ©r'   r(   r)   Útranslationr   r   r   Úget_storyTitleG   ó   þýúz0StoryContentSocialMediaSerializer.get_storyTitlec                 C   r7   r8   )r   r   r"   r#   r   r:   r1   r;   r   r   r   Úget_storyOpeningQ   r>   z2StoryContentSocialMediaSerializer.get_storyOpeningc                 C   r7   r8   )r   r   r"   r#   r   r:   r2   r;   r   r   r   Úget_storyDevelopment[   r>   z6StoryContentSocialMediaSerializer.get_storyDevelopmentc                 C   r7   r8   )r   r   r"   r#   r   r:   r3   r;   r   r   r   Úget_storyResolutione   r>   z5StoryContentSocialMediaSerializer.get_storyResolutionc                 C   r7   r8   )r   r   r"   r#   r   r:   r4   r;   r   r   r   Úget_captiono   r>   z-StoryContentSocialMediaSerializer.get_captionc                 C   r7   r8   )r   r   r"   r#   r   r:   r5   r;   r   r   r   Úget_ctay   r>   z)StoryContentSocialMediaSerializer.get_ctac                 C   r   )N)r9   Tr   )r   r	   r"   r#   r   Ú)StoryContentSocialMediaHashtagsSerializerr   r%   r&   r   r   r   Úget_hashtagListƒ   r,   z1StoryContentSocialMediaSerializer.get_hashtagListN)r   r   r   r   r/   r0   r1   r2   r3   r4   r5   r6   r   r=   r?   r@   rA   rB   rC   rE   r   r   r   r   r$   0   s     





r$   c                   @   ó   e Zd ZG dd„ dƒZdS )Ú)StoryContentSocialMediaLanguageSerializerc                	   @   s&   e Zd ZeZddddddddeg	Zd	S )
z.StoryContentSocialMediaLanguageSerializer.Metar   r0   r1   r2   r3   r4   r5   r9   N)r   r   r   r   r   r   r   r   r   r   r   r   Ž   s    ÷r   N©r   r   r   r   r   r   r   r   rG   �   ó    rG   c                   @   s*   e Zd Ze ¡ ZG dd„ dƒZdd„ ZdS )rD   c                   @   r   )z.StoryContentSocialMediaHashtagsSerializer.Meta)r   ÚkeyNamer9   ÚtextN)r   r   r   r	   r   r   r   r   r   r   r       r   r   c                 C   r7   )N)Ú!storyContentSocialMediaHashtagsIdr)   )r   r
   r"   r#   r   r:   rK   r;   r   r   r   Úget_text©   r>   z2StoryContentSocialMediaHashtagsSerializer.get_textN)r   r   r   r   r/   rK   r   rM   r   r   r   r   rD   �   s    	rD   c                   @   rF   )Ú1StoryContentSocialMediaHashtagsLanguageSerializerc                   @   s   e Zd ZeZdddegZdS )z6StoryContentSocialMediaHashtagsLanguageSerializer.Metar   rK   rL   N)r   r   r   r
   r   r   r   r   r   r   r   r   µ   s    ür   NrH   r   r   r   r   rN   ´   rI   rN   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 )r-   c                   @   r   )z%StoryContentAppContentSerializer.Meta)r   r   ÚtitleÚstoryÚkeyTakeawayÚimportantNoteN)r   r   r   r   r   r   r   r   r   r   r   Å   r   r   c                 C   r7   ©N)ÚstoryContentAppContentIdr)   )r   r   r"   r#   r   r:   rO   r;   r   r   r   Ú	get_titleÐ   r>   z*StoryContentAppContentSerializer.get_titlec                 C   r7   rS   )r   r   r"   r#   r   r:   rP   r;   r   r   r   Ú	get_storyÚ   r>   z*StoryContentAppContentSerializer.get_storyc                 C   r7   rS   )r   r   r"   r#   r   r:   rQ   r;   r   r   r   Úget_keyTakeawayä   r>   z0StoryContentAppContentSerializer.get_keyTakeawayc                 C   r7   rS   )r   r   r"   r#   r   r:   rR   r;   r   r   r   Úget_importantNoteî   r>   z2StoryContentAppContentSerializer.get_importantNoteN)r   r   r   r   r/   rO   rP   rQ   rR   r   rU   rV   rW   rX   r   r   r   r   r-   ¿   s    


r-   c                   @   rF   )Ú(StoryContentAppContentLanguageSerializerc                   @   s"   e Zd ZeZddddddegZdS )z-StoryContentAppContentLanguageSerializer.Metar   rO   rP   rQ   rR   rT   N)r   r   r   r   r   r   r   r   r   r   r   r   ú   s    ùr   NrH   r   r   r   r   rY   ù   rI   rY   N)Úrest_frameworkr   Úcommon.commonr   Úmama_care_api.settingsr   Ústory_content_modelsr   r   r   r	   r
   r   r   ÚModelSerializerr   r$   rG   rD   rN   r-   rY   r   r   r   r   Ú<module>   s    $ ]: