o
    ai                     @   s   d dl mZ ddlT d dlmZ d dl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)languageKeyc                   @   :   e Zd Ze Ze ZG dd dZdd Zdd Z	dS )FAQCategorySerializerc                   @      e Zd ZeZg dZdS )zFAQCategorySerializer.Meta)idcreatedDateupdatedDatetitlefaqListN)__name__
__module____qualname__FAQCategorymodelfields r   r   d/var/www/snowflake_co_dev_github/snow_flake_back_end_deploy/mama_care_api/information/serializers.pyMeta       r   c                 C   J   t | }|d ur!tjjt|jdj|d}| dkr#|d jS d S d S )NfaqCategoryId
languageIdr   )r   FAQCategoryLanguageobjectsfilterstrr
   __len__r   )selfinstancer   faqCategoryLanguageListr   r   r   	get_title      
zFAQCategorySerializer.get_titlec                 C   ,   t | }tjj|jd}t|t|iddjS )Nr   Tcontextmany)r   FAQr   r    r
   FAQSerializerr   datar#   r$   r   dataListr   r   r   get_faqList   s   
z!FAQCategorySerializer.get_faqListN)
r   r   r   r   SerializerMethodFieldr   r   r   r&   r1   r   r   r   r   r      s    	r   c                   @      e Zd ZG dd dZdS )FAQCategoryLanguageSerializerc                   @       e Zd ZeZdddddegZdS )z"FAQCategoryLanguageSerializer.Metar
   r   r   r   r   N)r   r   r   r   r   r   r   r   r   r   r   r   !       r   Nr   r   r   r   r   r   r   r   r4           r4   c                   @   r   )r-   c                   @   r	   )zFAQSerializer.Meta)r
   r   r   r   questionanswerN)r   r   r   r,   r   r   r   r   r   r   r   1   r   r   c                 C   r   N)faqIdr   r   )r   FAQLanguager   r    r!   r
   r"   r9   r#   r$   r   faqLanguageListr   r   r   get_question<      
zFAQSerializer.get_questionc                 C   r   r;   )r   r=   r   r    r!   r
   r"   r:   r>   r   r   r   
get_answerE   rA   zFAQSerializer.get_answerN)
r   r   r   r   r2   r9   r:   r   r@   rB   r   r   r   r   r-   -   s    	r-   c                   @   r3   )FAQLanguageSerializerc                   @   s"   e Zd ZeZddddddegZdS )zFAQLanguageSerializer.Metar
   r9   r:   r   r   r<   N)r   r   r   r=   r   r   r   r   r   r   r   r   P   s    r   Nr7   r   r   r   r   rC   O   r8   rC   c                   @   *   e Zd Ze ZG dd dZdd ZdS )InformationTypeSerializerc                   @   r	   )zInformationTypeSerializer.Meta)r
   keyNameinformationListN)r   r   r   InformationTyper   r   r   r   r   r   r   `   r   r   c                 C   r(   )N)informationTypeId__keyNameTr)   )r   Informationr   r    rF   InformationSerializerr   r.   r/   r   r   r   get_informationListd      z-InformationTypeSerializer.get_informationListN)r   r   r   r   r2   rG   r   rL   r   r   r   r   rE   ^   s    rE   c                   @   r   )rK   c                   @   r	   )zInformationSerializer.Meta)r
   informationTypeIdr   r   r   sectionListN)r   r   r   rJ   r   r   r   r   r   r   r   n   r   r   c                 C   r   )NinformationIdr   r   )r   InformationLanguager   r    r!   r
   r"   r   )r#   r$   r   informationLanguager   r   r   r&   y   r'   zInformationSerializer.get_titlec                 C   r(   )NrP   Tr)   )r   Sectionr   r    r
   SectionSerializerr   r.   r/   r   r   r   get_sectionList   rM   z%InformationSerializer.get_sectionListN)
r   r   r   r   r2   r   rO   r   r&   rV   r   r   r   r   rK   k       	rK   c                   @   r3   )InformationLanguageSerializerc                   @   r5   )z"InformationLanguageSerializer.Metar
   r   r   r   rQ   N)r   r   r   rR   r   r   r   r   r   r   r   r      r6   r   Nr7   r   r   r   r   rX          rX   c                   @   r   )rU   c                   @   r	   )zSectionSerializer.Meta)r
   rF   r   r   rQ   descriptioncontentListN)r   r   r   rT   r   r   r   r   r   r   r      r   r   c                 C   r   )N	sectionIdr   r   )r   SectionLanguager   r    r!   r
   r"   rZ   )r#   r$   r   sectionLanguager   r   r   get_description   r'   z!SectionSerializer.get_descriptionc                 C   r(   )Nr\   Tr)   )r   Contentr   r    r
   ContentSerializerr   r.   r/   r   r   r   get_contentList   rM   z!SectionSerializer.get_contentListN)
r   r   r   r   r2   rZ   r[   r   r`   rc   r   r   r   r   rU      rW   rU   c                   @   r3   )SectionLanguageSerializerc                   @   r5   )zSectionLanguageSerializer.Metar
   rZ   r   r   r]   N)r   r   r   r^   r   r   r   r   r   r   r   r      r6   r   Nr7   r   r   r   r   rd      rY   rd   c                   @   rD   )rb   c                   @   r	   )zContentSerializer.Meta)r
   rF   r   r   r]   rZ   N)r   r   r   ra   r   r   r   r   r   r   r      r   r   c                 C   r   )N)	contentIdr   r   )r   ContentLanguager   r    r!   r
   r"   rZ   )r#   r$   r   contentLanguager   r   r   r`      r'   z!ContentSerializer.get_descriptionN)r   r   r   r   r2   rZ   r   r`   r   r   r   r   rb      s    rb   c                   @   r3   )ContentLanguageSerializerc                   @   r5   )zContentLanguageSerializer.Metar
   rZ   r   r   re   N)r   r   r   rf   r   r   r   r   r   r   r   r      r6   r   Nr7   r   r   r   r   rh      rY   rh   N)rest_frameworkr   modelscommon.commonr   mama_care_api.settingsr   ModelSerializerr   r4   r-   rC   rE   rK   rX   rU   rd   rb   rh   r   r   r   r   <module>   s    "