
    ei"                        d dl mZ d dlmZmZmZ d dl ddl d dlm	Z	 d dl
m
Z
 d dlmZ d dl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d dlZ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y)    )serializers)ServiceContentManagementSkill)*   )FortunetellerRatingReviews)datetime)	timesinceNc                        e Zd Z G d d      Zy)ServiceSerializerc                       e Zd ZeZdZy)ServiceSerializer.Meta__all__N)__name__
__module____qualname__r   modelfields     :/var/www/html/Ryun_Seer/seer/fortune_teller/serializers.pyMetar      s    
%&r   r   Nr   r   r   r   r   r   r   r   r   
        r   r   c                        e Zd Z G d d      Zy)SkillSerializerc                       e Zd ZeZdZy)SkillSerializer.Metar   N)r   r   r   r   r   r   r   r   r   r   r      s    
%&r   r   Nr   r   r   r   r   r      r   r   r   c                   X    e Zd Z e       Z e       Z e       Z e	       Z
 G d d      Zy)FortuneSignSerializerc                       e Zd ZeZg dZy)FortuneSignSerializer.Meta)	horoscopechinese_zodiacfive_elementmbtiN)r   r   r   FortuneTellerSignDetailr   r   r   r   r   r   r#      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	 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)FortuneTellerSerializerzfortune_signs.first)sourceget_chat_priceget_video_priceget_is_favouritec                       e Zd ZeZg dZy)FortuneTellerSerializer.Meta)id
first_name	last_nameemailgenderservicesskillsdate_of_birthphone_number	fcm_tokendevice_typetotal_experience	languagesbiobank_detailstimezoneimagenotification_statusis_profile_completedis_stripe_account_connectis_stripe_verifiedratingreferal_codevideo_price
chat_priceis_favourite	is_onlinefortune_signsN)r   r   r   FortuneTellerr   r   r   r   r   r   r4   (   s    
%M&r   r   c                     |j                   }|r-|j                  d      D cg c]  }|j                          c}S g S c c}w N,)r:   splitstrip)selfobjservices_stringservices       r   get_servicesz$FortuneTellerSerializer.get_services.   sA    LL/*9*?*?*D
E*Dw7==?*D
EE	) F   >c                     |j                   }|r-|j                  d      D cg c]  }|j                          c}S g S c c}w rS   )r;   rU   rV   )rW   rX   skills_stringskills       r   
get_skillsz"FortuneTellerSerializer.get_skills4   sA    **-&3&9&9#&>
?&>U5;;=&>
??	) @r\   c                     |j                   }|r-|j                  d      D cg c]  }|j                          c}S g S c c}w rS   )rA   rU   rV   )rW   rX   languages_stringlanguages       r   get_languagesz%FortuneTellerSerializer.get_languages:   sC    ]],<,B,B3,G
H,G8>>,G
HH	) Ir\   c                 >   t         j                  j                  |      j                         }|rm|j                  }t        j                  |      }t        j                         }|j                         }g d}||   }|D ]  }	|	d   |k(  s|	d   r|	d   }
d}
 
S y)Nfortune_tellerMondayTuesday	WednesdayThursdayFridaySaturdaySundayday	is_activerL   N/A
FortuneTellerTimingobjectsfilterfirstslotsjsonloadsr
   nowweekdayrW   rX   fortune_time_slots
slots_datatimedatacurrent_timer|   weekday_namesweekday_namedata
price_datas              r   r1   z'FortuneTellerSerializer.get_video_price@   s    *22999MSSU"((:jj$8,,.<!!#7a=(<tE{l"[&jj  
r   c                 >   t         j                  j                  |      j                         }|rm|j                  }t        j                  |      }t        j                         }|j                         }g d}||   }|D ]  }	|	d   |k(  s|	d   r|	d   }
d}
 
S y)Nrf   rh   rp   rq   rM   rr   rs   r}   s              r   r0   z&FortuneTellerSerializer.get_chat_priceS   s    *22999MSSU"((:jj$8,,.<!!#7a=(<tE{l"[%jj  
r   c                     | j                   j                  d      }t        j                  j	                  ||      j                         }|rd}|S d}|S )N	seer_user)fortuner   TF)contextgetFavouriteUnfavouriteFortuneru   rv   rw   )rW   rX   
login_userfortune_favouriterN   s        r   r2   z(FortuneTellerSerializer.get_is_favouritef   sY    ||,*199@@Wa@bhhj< 
 <	r   N)r   r   r   r!   rP   r   SerializerMethodFieldr:   r;   rA   rM   rL   rN   r   r[   r`   rd   r1   r0   r2   r   r   r   r.   r.      s    &.CD-K--/
++
+
+
-.[..0/k//7GH0{008IJ1119KLM M&&r   r.   c                   H    e Zd Z ej                         Zd Z G d d      Zy)FortuneNotificationSerializerc                 2    t        |j                        dz   S )Nz ago)r   
created_at)rW   rX   s     r   get_created_at_agoz0FortuneNotificationSerializer.get_created_at_agot   s    	3>>	"V	++r   c                       e Zd ZeZg dZy)"FortuneNotificationSerializer.Meta)r5   messagenotification_typeis_read
updated_atcreated_at_agoN)r   r   r   FortuneTellerNotificationsr   r   r   r   r   r   r   w   s    
$%\&r   r   N)r   r   r   r   r   r   r   r   r   r   r   r   r   q   s#    3+335,] ]r   r   c                   H    e Zd Z ej                         Z G d d      Zd Zy)FortuneTimingSerializerc                       e Zd ZeZg dZy)FortuneTimingSerializer.Meta)rx   r   r   N)r   r   r   rt   r   r   r   r   r   r   r      s    
%.&r   r   c                 H    |j                   }t        j                  |      }|S )N)rx   ry   rz   )rW   rX   r   jsonDatas       r   	get_slotsz!FortuneTimingSerializer.get_slots   s    yy*ZZ
#(	/r   N)r   r   r   r   r   rx   r   r   r   r   r   r   r   }   s!    	*	*	*	,/ /r   r   c                   r    e Zd Z ej                  dd      Z ej                  dd      Z ej                  dd      Z ej                  d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 fdZ xZS ) AppointmentRequestListSerializerseer_user.first_nameTr/   	read_onlyseer_user.last_namezseer_user.idzseer_user.professionzseer_user.primary_imagezseer_user.statezseer_user.cityzseer_user.date_of_birthc                       e Zd ZeZg dZy)%AppointmentRequestListSerializer.Meta)r5   appointment_idpriceappointment_dateappointment_timer   user_idr6   r7   
professionprimary_imagestatecityr<   service_typetwilio_channel_sidtwilio_room_nameappointment_statusN)r   r   r   FortuneAppointmentBookr   r   r   r   r   r   r      s    
 % I&r   r   c                 l   t         t        |   |      }t        j                  |j
                  j                        }t        j                  |j                  j                        }|d   }|d   }|j                  d      \  }}t        j                  |j                         d      }	t        j                  |j                         d      }
t        j                  |d      }|j                  |	j                  |	j                        }|j                  |
j                  |
j                        }|j                  |      }|j                  |      }|j                  |      }|j                  |      }|j!                  d      }||d<   |j!                  d      dz   |j!                  d      z   |d<   |S )Nr   r   -z%I:%M %pz%d %B %Y)hourminute)superr   to_representationpytzrD   r   rg   rU   r
   strptimerV   replacer   r   localize
astimezonestrftime)rW   instancer   user_timezonefortune_timezoneappointment_date_strappointment_time_rangestart_time_strend_time_str
start_timeend_timer   start_datetimeend_datetimestart_time_user_timezoneend_time_user_timezonestart_time_fortuneend_time_fortuneformatted_date	__class__s                      r   r   z2AppointmentRequestListSerializer.to_representation   s   	/	H	R$ -- 2 2 ; ;<-]]8#:#:#C#CD 01 23!7!=!=c!B.,   !5!5!7D*|113Z@( &&';ZH $++IZIZ+[.!))x}}X__)U, +33NC(11,? 0::;KL+667GH%..z:. ,$/88DsJM]MfMfgqMrr$	+r   )r   r   r   r   	CharFieldr6   r7   r   r   r   r   r   r<   r   r   __classcell__)r   s   @r   r   r      s    #k##+ATR"[""*?4P ;  $G#k##+ATR'+''/HTXY
+

'8D
I			&6$	G'+''/HTXYI I
& &r   r   c                        e Zd Z G d d      Zy)ForutuneTellerWalletSerializerc                       e Zd ZeZdZy)#ForutuneTellerWalletSerializer.Metar   N)r   r   r   FotuneTellerWalletr   r   r   r   r   r   r      s    
%&r   r   Nr   r   r   r   r   r      r   r   r   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)	WalletTranscationSerializerr   Tr   r   fortune_teller.first_namec                       e Zd ZeZg dZy) WalletTranscationSerializer.Meta)	r5   transcation_idamountuser_first_namer   user_last_namefortune_first_namefortune_last_nametranscation_typeN)r   r   r   FortuneTellerTranscationsr   r   r   r   r   r   r      s    
#% Y&r   r   N)
r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      sh    (;((0FRVW'+''/DPTU+k++3NZ^_*[**2MY]^Y Yr   r   c                   p    e Zd Z ej                  dd      Z ej                  dd      Z G d d      Zy)PayoutTranscationSerializerr   Tr   c                       e Zd ZeZg dZy) PayoutTranscationSerializer.Meta)r5   r   r   r   r   r   transcation_statusN)r   r   r   FortunePayoutTranscationr   r   r   r   r   r   r      s    
"%w&r   r   N)r   r   r   r   r   r   r   r   r   r   r   r   r      s<    +k++3NZ^_*[**2MY]^x xr   r   )rest_frameworkr   admin_panel.modelsr   r   r   admin_panel.serializersmodelsfortune_teller.modelsr	   r
   django.utils.timesincer   ry   ModelSerializerr   r   r!   r.   r   r   r   r   r   r   r   r   r   r   <module>r      s    & @ @ %  <  , 33 k11 
CK77 CNk99 Nd]K$?$? ]	k99 	  5{'B'B 5n[%@%@ Y+"="= Yx+"="= xr   