
    =NCe>                        d dl mZ d dl ddl d dlmZmZmZ d dl d dl	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 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 G d dej                        Z G d  d!ej                        Zy")#    )serializers)*   )ContentManagementFaqCompatibilityHoroscope)	timesincec                   X    e Zd Z e       Z e       Z e       Z e	       Z
 G d d      Zy)SeerSignSerializerc                       e Zd ZeZg dZy)SeerSignSerializer.Meta)	horoscopechinese_zodiacfive_elementmbtiN)__name__
__module____qualname__SeerUserSignDetailmodelfields     5/var/www/html/Ryun_Seer/seer/seer_user/serializers.pyMetar      s    
%B&r   r   N)r   r   r   HoroscopeSerializerr   ChineseZodiacSerializerr   FiveElementsSerializerr   MBTISerializerr   r   r   r   r   r   r   
   s.     ")+&(C Cr   r   c                       e Zd Z ed      Z ej                         Z ej                         Z ej                         Z	 G d d      Z
d Zd Zd Zy)	SeerUserSerializerseer_signs.firstsourcec                       e Zd ZeZg dZy)SeerUserSerializer.Meta)id
first_name	last_nameemailgenderdate_of_birthphone_number	fcm_tokendevice_typereligion
professionheightnotification_statuscountry_originstatecity	languageshobbiesbio	educationincomeimagestimezoneis_profile_completedreferal_code
seer_signsNr   r   r   SeerUserr   r   r   r   r   r   r&      s    
%O&r   r   c                     |j                   }|r2|j                  d      j                  dd      j                  d      }|S g }|S Nz[]' z, r7   stripreplacesplitselfobjlanguages_stringlanguages_arrays       r   get_languagesz SeerUserSerializer.get_languages    L    ]]%++D199#rBHHN? 
 ?	r   c                     |j                   }|r2|j                  d      j                  dd      j                  d      }|S g }|S rD   r8   rH   rI   rJ   rL   rM   hobbies_stringhobbies_arrays       r   get_hobbieszSeerUserSerializer.get_hobbies(   K    ;;.!''-55c2>DDTJ= 
 =	r   c                     |j                   }|r2|j                  d      j                  dd      j                  d      }|S g }|S rD   r<   rH   rI   rJ   rL   rM   images_stringimages_arrays       r   
get_imageszSeerUserSerializer.get_images0   K    **-%%d+33C<BB4H< 
 <	r   N)r   r   r   r   r@   r   SerializerMethodFieldr7   r8   r<   r   rP   rW   r^   r   r   r   r!   r!      sX     (:;.[..0,;,,.
++
+
+
-O Or   r!   c                   H    e Zd Z ej                         Zd Z G d d      Zy)UserNotificationSerializerc                 2    t        |j                        dz   S )Nz ago)r	   
created_at)rL   rM   s     r   get_created_at_agoz-UserNotificationSerializer.get_created_at_ago;   s    	3>>	"V	++r   c                       e Zd ZeZg dZy)UserNotificationSerializer.Meta)r'   messagenotification_typeis_read
updated_atcreated_at_agoN)r   r   r   SeerUserNotificationsr   r   r   r   r   r   rg   >   s    
%\&r   r   N)r   r   r   r   r`   rl   re   r   r   r   r   rb   rb   9   s#    3+335,] ]r   rb   c                        e Zd Z G d d      Zy)ServiceSerializerc                       e Zd ZeZddgZy)ServiceSerializer.Metar'   service_nameN)r   r   r   Servicer   r   r   r   r   r   rq   G   s    
%."&r   r   Nr   r   r   r   r   r   r   ro   ro   F   s    # #r   ro   c                        e Zd Z G d d      Zy)LanguageSerializerc                       e Zd ZeZdgZy)LanguageSerializer.Metar7   NrA   r   r   r   r   rx   L   s    
%>&r   r   Nrt   r   r   r   rv   rv   K   s     r   rv   c                        e Zd Z G d d      Zy)SeerUserWalletSerializerc                       e Zd ZeZdZy)SeerUserWalletSerializer.Meta__all__N)r   r   r   SeerUserWalletr   r   r   r   r   r   r|   R   s    
%&r   r   Nrt   r   r   r   rz   rz   Q        r   rz   c                       e Zd Z ej                  dd      Z ej                  dd      Z ej                  dd      Z ej                  dd      Z G d d      Z	y	)
AppointmentFortuneTellerzfortune_teller.first_nameTr$   	read_onlyzfortune_teller.last_namezfortune_teller.imagezfortune_teller.servicesc                       e Zd ZeZg dZy)AppointmentFortuneTeller.Meta)r'   appointment_idr(   r)   fortune_teller_servicesappointment_dateimageappointment_timeserviceservice_typepriceappointment_statustwilio_channel_sidtwilio_room_nameN)r   r   r   FortuneAppointmentBookr   r   r   r   r   r   r   ]   s    
 % h&r   r   N)
r   r   r   r   	CharFieldr(   r)   r   r   r   r   r   r   r   r   W   sf    #k##+FRVW"[""*DPTU			&<	M1K11;T_cdh hr   r   c                        e Zd Z G d d      Zy)SeerUserCardSerializerc                       e Zd ZeZdZy)SeerUserCardSerializer.Metar}   N)r   r   r   SeerUserCardsr   r   r   r   r   r   r   b   s    
%&r   r   Nrt   r   r   r   r   r   a   r   r   r   c                   p    e Zd Z ej                  dd      Z ej                  dd      Z G d d      Zy)WalletTranscationSerializerz!booking.fortune_teller.first_nameTr   z booking.fortune_teller.last_namec                       e Zd ZeZg dZy) WalletTranscationSerializer.Meta)r'   transcation_idamountr(   rd   r(   r)   transcation_typeN)r   r   r   SeerUserTranscationr   r   r   r   r   r   r   l   s    
%r&r   r   N)r   r   r   r   r   r(   r)   r   r   r   r   r   r   g   s:    #k##+NZ^_"[""*LX\]s sr   r   c                       e Zd Z ej                  dd      Z ej                  dd      Z ej                  dd      Z G d d      Zy)	FortunerTellerReviewSerializerzseer_user.primary_imageTr   zseer_user.first_namezseer_user.last_namec                       e Zd ZeZg dZy)#FortunerTellerReviewSerializer.Meta)	r'   	seer_userseer_user_first_nameseer_user_last_namefortune_tellerratingreviewrd   seer_user_imageN)r   r   r   FortunetellerRatingReviewsr   r   r   r   r   r   r   v   s    
$% N&r   r   N)	r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   sR    )K))1JVZ[...6LX\]---5JVZ[N Nr   r   c                   .   e Zd Z ed      Z ej                         Z ej                         Z ej                         Z	 ej                  d      Z
 ej                  d      Z ej                  d      Z G d d      Zd Zd	 Zd
 Zd Zd Zd Zy)SeerUserCompatibilitySerializerr"   r#   get_compatibilityget_login_user_signsget_friend_statusc                       e Zd ZeZg dZy)$SeerUserCompatibilitySerializer.Meta)r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r4   r5   r6   r7   r8   r9   r:   r;   r<   r>   r@   compatibilitylogin_user_signsfriend_statusNrA   r   r   r   r   r      s    
%i&r   r   c                     |j                   }|r2|j                  d      j                  dd      j                  d      }|S g }|S rD   rG   rK   s       r   rP   z-SeerUserCompatibilitySerializer.get_languages   rQ   r   c                     |j                   }|r2|j                  d      j                  dd      j                  d      }|S g }|S rD   rS   rT   s       r   rW   z+SeerUserCompatibilitySerializer.get_hobbies   rX   r   c                     |j                   }|r2|j                  d      j                  dd      j                  d      }|S g }|S rD   rZ   r[   s       r   r^   z*SeerUserCompatibilitySerializer.get_images   r_   r   c                 ,   | j                   j                  d      }t        j                  j	                  |      j                         }t        j                  j	                  |      j                         }|j                  j                  }|j                  j                  }|j                  j                  }|j                  r|j                  j                  }nd }|j                  j                  }	|j                  r|j                  j                  }
nd }
g }i }|r|
r	d}d}d}d}nd}d}d}d}|	d	k(  rt        j                  j	                  ||j                  j                  
      j                         }t        j                  j	                  ||j                  j                        j                         }t         j                  j	                  ||j                  j                        j                         }t"        j                  j	                  ||
      j                         }nt        j                  j	                  |j                  j                  |
      j                         }t        j                  j	                  |j                  j                  |      j                         }t         j                  j	                  |j                  j                  |      j                         }t"        j                  j	                  |
|      j                         }||j$                  z  }||j$                  z  }||j$                  z  }||r|j$                  |j$                  ndz  }||z   |z   |z   }|j&                  |j$                  |j(                  |j&                  |j$                  |j(                  |j&                  |j$                  |j(                  |sd n|j&                  |sd n|j$                  |sd n|j(                  |d}|S )Nseer_user_idr   g      ?g333333?g?r   g333333?g?Male)male_horoscopefemale_horoscope)male_chinese_zodiacfemale_chinese_zodiac)male_element_namefemale_element_name)male_mbti_namefemale_mbti_name)horoscope_taglinehoroscope_compatibility_scorehoroscope_descriptionchinese_zodiac_tagline"chinese_zodiac_compatibility_scorechinese_zodiac_descriptionfive_elements_tagline!five_elements_compatibility_scorefive_elements_descriptionmbti_taglinembti_compatibility_scorembti_descriptiontotal_weighted_score)contextgetr   objectsfilterfirstr   r   r   element_namer   	mbti_namer   r+   r   CompatibilityChineseZodiacCompatibilityFiveElementsCompatibilityMBTIcompatibility_scoretaglinedescription)rL   rM   login_user_id
login_usermatched_user_signslogin_user_horoscopelogin_user_chinese_zodiaclogin_user_element_namelogin_user_mbti_namelogin_user_gendermatched_user_mbticompatibility_scorescompatibility_datambti_weighthoroscope_weightchinese_zodiac_weightelement_weighthoroscope_compatibilitychinese_zodiac_compatibilityfive_elements_compatibilitymbti_compatibilityhoroscope_scorezodiac_scoreelement_score
mbti_scorer   s                             r   r   z1SeerUserCompatibilitySerializer.get_compatibility   s   ,,"">2-!))00=0IOOQ*)118838GMMO#--77(77FF&33@@__$//33!++22)..88/;>;>& 3;;BBRf)33== C ??Duw  #="D"D"K"K`y.==LL #L #NNSeg   ";!B!B!I!I\s,99FF "J "HHM  *1188H\( 9 **/%'  4;;BBRdRnRnRxRx+ C --2UW  #="D"D"K"K`r  aB  aB  aQ  aQ5 #L #77<uw   ";!B!B!I!I\n\{\{  ]I  ]I1 "J "33857  *1188HY+ 9 --2UW  %'>'R'RR/&)E)Y)YY, #>#R#RR-HZ_q  `F  `F  `R0DD  XY  Z* $o5D}T199&=&Q&Q5AA:BB+G+[+[">"J"J8@@*E*Y*Y!<!H!H!3T9K9S9S-?EWEkEk%7=O=[=[1#( 
r   c           	      0   | j                   j                  d      }t        j                  j	                  |      j                         }|j                  j                  }|j                  j                  }|j                  j                  }|j                  j                  }|j                  j                  }|j                  j                  }	|j                  r-|j                  j                  }
|j                  j                  }nd }
d }||||||	|
|d}|S )Nr   r   )r   horoscope_imager   chinese_zodiac_imager   element_imager   
mbti_image)r   r   r   r   r   r   r   r   r   r   r   r   r   )rL   rM   r   r   r   r   r   r   r   r   r   r   login_user_datas                r   r   z4SeerUserCompatibilitySerializer.get_login_user_signs   s    ,,"">2-!))00=0IOOQ*"",,),,;;.((55,((../#2288))//-__((9%%:9: $". 	/ 
r   c                    | j                   j                  d      }t        d|       t        j                  j                  |      j                         }t        j                  j                  t        j                  ||      t        j                  ||      z        }|sd }|S |D ]&  }|j                  dk(  rd}|j                  dk(  s%d}( |S )	Nr   login_user=========)r'   	from_userto_userTfriendsF	requested)r   r   printrB   r   r   r   FriendRequestmodelsQaccepted)rL   rM   r   r   r   r  s         r   r   z1SeerUserCompatibilitySerializer.get_friend_status  s    ,,"">2-m,&&-&8>>@*
  ''..	J	4vxx#Wax7b	b- 
= 
  w]			U	" ]	  
 
r   N)r   r   r   r   r@   r   r`   r7   r8   r<   r   r   r   r   rP   rW   r^   r   r   r   r   r   r   r   r   |   s     (:;.[..0,;,,.
++
+
+
-222:MN5K55=ST222:MNi iRh:r   r   c                   L    e Zd Z ej                  d      Z G d d      Zd Zy)SeerUserFriendSerializerr   r#   c                       e Zd ZeZg dZy)SeerUserFriendSerializer.Meta)
r'   r(   r)   r,   primary_imager1   r5   r6   r4   r   NrA   r   r   r   r   r  3  s    
%(&r   r   c                 N   | j                   j                  d      }t        d|       t        j                  j                  t        j                  ||      t        j                  ||      z        }|sd }|S |D ]&  }|j                  dk(  rd}|j                  dk(  s%d}( |S )Nr   r   r   Tr  Fr  )	r   r   r  r  r   r   r  r  r  )rL   rM   r   r   r  s        r   r   z*SeerUserFriendSerializer.get_friend_status8  s    ||-*j)
  ''..	J	4vxx#Wax7b	b- 
= 
  w]			U	" ]	  
 
r   N)r   r   r   r   r`   r   r   r   r   r   r   r	  r	  1  s$    222:MN( (
r   r	  c                   .    e Zd Z e       Z G d d      Zy)SentFriendListSerializerc                       e Zd ZeZg dZy)SentFriendListSerializer.Meta)r'   r   r  Nr   r   r   r  r   r   r   r   r   r   r  P  s    
%(&r   r   N)r   r   r   r	  r   r   r   r   r   r  r  M  s    #%) )r   r  c                   .    e Zd Z e       Z G d d      Zy)ReceivedFriendListSerializerc                       e Zd ZeZg dZy)!ReceivedFriendListSerializer.Meta)r'   r   r  Nr  r   r   r   r   r  X  s    
%*&r   r   N)r   r   r   r	  r   r   r   r   r   r  r  U  s    %'+ +r   r  N)rest_frameworkr   admin_panel.serializersr  admin_panel.modelsr   r   r   fortune_teller.modelsdjango.utils.timesincer	   ModelSerializerr   r!   rb   ro   rv   rz   r   r   r   r   r   r	  r  r  r   r   r   <module>r     s)   & %  K K # ,C44 C"44 "J]!<!< ]#33 #
44 {:: h{:: h[88 s+"="= sN[%@%@ Npk&A&A pj{:: 8){:: )+;#>#> +7r   