
    V0f/r                       d dl mZ d dlmZ d dlmZ d dlT d dlZd dlmZm	Z	 d dl
mZ d dlmZ d dlZd dlT d d	lmZ d dlZd d
lmZ d dlmZ d dlmZ d dlmZ d dlmZmZmZ d dlm Z  d dl!m"Z" d dl#Z#d dlZd dl$Z$d dl%Z%d dl&m'Z' d dl(T d dl)m*Z* d dl+m,Z, d dl+m-Z- d dl.Z.ddl/T d dl0m1Z1 d dl2Z2d dl3m4Z4m5Z5m6Z6 d dl7m8Z8 d dl9m:Z: d dl;m<Z< ddl=m>Z> ej?        Z@ejA        ZBejC        ZDejE        ZFejG        ZHejI        ZJ e8e@eB          ZKd ZLd ZM G d de          ZN G d  d!e          ZO G d" d#e          ZP G d$ d%e          ZQ G d& d'e          ZR G d( d)e          ZS G d* d+e          ZT G d, d-e          ZU G d. d/e          ZV G d0 d1e          ZW G d2 d3e          ZX G d4 d5e          ZY G d6 d7e          ZZ G d8 d9e          Z[ G d: d;e          Z\ G d< d=e          Z] G d> d?e          Z^ G d@ dAe          Z_ G dB dCe          Z` G dD dEe          Za G dF dGe          Zb G dH dIe          Zc G dJ dKe          Zd G dL dMe          Ze G dN dOe          Zf G dP dQe          Zg G dR dSe          Zh G dT dUe          Zi G dV dWe          Zj G dX dYe          Zk G dZ d[e          Zl G d\ d]e          Zm G d^ d_e          Zn G d` dae          Zo G db dce          Zp G dd dee          Zq G df dge          Zr G dh die          Zs G dj dke          Zt G dl dme          Zu G dn doe          Zv G dp dqe          Zw G dr dse          ZxdS )t    )APIView)Responsestatus)*N)datetimedate)settings)django_pbkdf2_sha256)get_authorization_header)RefreshToken)TokenBackend)EmailMultiAlternatives)
exceptions)renderredirectHttpResponse)mail)render_to_string)messages)	timesince)Max)Q   )FCMNotification)	SyncGrant	ChatGrant
VideoGrant)Client)AccessToken)GoogleSearch)formsc                  .   t           j                                                                        } | rb| j        sdS | j        }|dd          }t          |          dz   }t          |          }|                    d          }dt          |          z   S dS )NBOOK0001   r   BOOK)UserBookingsobjectsalllast
booking_idintstrzfilllastObjtheIds     5/var/www/html/Manimaran/manimaran/user_panel/views.pygernateBookingIdr3   3   s    


"
"
$
$
)
)
+
+ 		 
*%abb	%E

1%E

%A%	E

		    c                  .   t           j                                                                        } | rb| j        sdS | j        }|dd          }t          |          dz   }t          |          }|                    d          }dt          |          z   S dS )NTRANS000001   r   TRANS)UserTranscationr(   r)   r*   transcation_idr,   r-   r.   r/   s     r2   generateTranscationsIdr;   C   s    

!
%
%
'
'
,
,
.
. 		 
-%abb	%E

1%E

%A%	U		r4   c                       e Zd Zd ZdS )getPrivacyPolicyc                 <   	 | j         j                            d          }|dk    r3t          j                            d                                          }n2t          j                            d                                          }|si }n|j        |j        |j	        d}t          t          j        d|d          S # t          $ rN}t          |           t          t          j        t!          |          dt          j        	          cY d }~S d }~ww xY w)
Npage_type_paramPrivacy	page_typeTermsidtitlecontentSuccessstatus_codestatus_messagedatarJ   rK   r   )requestquery_paramsgetContentPagesr(   filterfirstrE   rF   rG   r   r   HTTP_200_OK	ExceptionprintHTTP_500_INTERNAL_SERVER_ERRORr-   )selfrN   r?   data_objall_dataes         r2   rP   zgetPrivacyPolicy.getS   sK   Ol/334EFF?""#**Y*??EEGGHH#**W*==CCEEH
 HH +^ H
 &"4iW_``
a
aa	 O O O888
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOs   C C 
DADDDN__name__
__module____qualname__rP    r4   r2   r=   r=   R   s(        O O O O Or4   r=   c                       e Zd Zd ZdS )getTermsConditionsc                    	 t           j                            d                                          }|si }n|j        |j        |j        d}t          t          j	        d|d          S # t          $ rN}t          |           t          t          j        t          |          dt          j                  cY d }~S d }~ww xY w)NrC   rA   rD   rH   rI   rM   r   )rQ   r(   rR   rS   rE   rF   rG   r   r   rT   rU   rV   rW   r-   )rX   rN   	terms_objrZ   r[   s        r2   rP   zgetTermsConditions.geth   s    O#**W*==CCEE9
 HH ,_  H
 &"4iW_``
a
aa	 O O O888
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOs   A(A+ +
C5AB>8C>CNr\   r`   r4   r2   rb   rb   g   (        O O O O Or4   rb   c                       e Zd Zd ZdS )
faqListingc                    	 t           j                            d                              d          }g }|D ],}|j        |j        |j        d}|                    |           -t          t          j
        d|d          S # t          $ rN}t          |           t          t          j        t          |          dt          j                  cY d }~S d }~ww xY w)	NTend_date__isnull-idrD   rH   rI   rM   r   )Faqr(   rR   order_byrE   rF   rG   appendr   r   rT   rU   rV   rW   r-   )rX   rN   faq_objall_DatafaqrZ   r[   s          r2   rP   zfaqListing.gety   s   O[$77@@GG78  s
&Y{ H
 OOH
&"4iW_``
a
aa	 O O O888
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOs   B B 
CACCCNr\   r`   r4   r2   rg   rg   x   re   r4   rg   c                       e Zd Zd ZdS )userRegisterc                    	 |j                             d          }|s(t          t          j        ddt          j                  S |j                             d          }|s(t          t          j        ddt          j                  S |j                             d                                          }|s(t          t          j        ddt          j                  S t          j                            |	          	                                }|r(t          t          j        d
dt          j                  S |j                             d          }|s(t          t          j        ddt          j                  S |j                             d          }|s(t          t          j        ddt          j                  S ||k    r(t          t          j        ddt          j                  S |}t          j        |          }	t          j                            |d          	                                }
t          j                            |	|||d          }d                    d t          d          D                       }dt          |j                  z   dz   |z   }t          t"          j                  |z   }||_        |                                 d}t+          dd|i          }|}d}|}t-          j        ||||g|           d}dd lm}  |j                    }t+          d!||||d"          }|}d}d#}t-          j        ||||g|           t          t          j        d$d          S # t8          $ rN}t;          |           t          t          j        t          |          dt          j                  cY d }~S d }~ww xY w)%N
first_namezfirst_name is requiredrM   r   	last_namezlast_name is requiredemailEmail is requiredrw   z)This email is already registered with us.passwordPassword is requiredconfirm_passwordzConfirm Password is requiredz+Password and Confirm Password are not same.F)rw   is_email_verifiedT)rz   rw   ru   rv   is_user c                 d    g | ]-}t          j        t          j        t          j        z             .S r`   randomchoicestringascii_lettersdigits.0ns     r2   
<listcomp>z%userRegister.post.<locals>.<listcomp>   s,    ]]]afmF$86=$HII]]]r4      /api-user/email-verification//Email Verificationzworker_email_verification.htmllinksupport@olfix.co.ukhtml_messagezNew User Registeredr   )r	   znew_user_registered.html)ru   rv   rw   r	   zsuperadmin@yopmail.comzGYou have been successfully registered with us.Please verify your email.)rL   rP   r   r   HTTP_400_BAD_REQUESTlowerUserr(   rR   rS   handlerhashcreatejoinranger-   rw   r
   BASE_URLemail_verify_linksaver   r   	send_mailr   r	   todayrT   rU   rV   rW   )rX   rN   ru   rv   rw   check_emailrz   r|   string_passwordfinal_passwordcheck_customerObjcustomerObjran_numbaselinkcompletelinksubjectr   plain_message
from_emailtor	   r   r[   s                          r2   postzuserRegister.post   s   3O  ..:
 N6#>Phiiqw  rM  N  N  N  N|,,9
 M6#>Pghhpv  qL  M  M  M  M<G$$**,,5
 I6#>Pcddlr  mH  I  I  I  I$$5$117799; a6#>P{||  EK  E`  a  a  a  alz**8
 L6#>Pfggou  pK  L  L  L  Ll&&'9::
 T6#>Pnoow}  xS  T  T  T  T"""6#>P}~~  GM  Gb  c  c  c  c&?L11>|**5U*SSYY[[|""n5T^ir  ~B"  C  C;WW]]SXY[S\S\]]]^^7.[5F1G1GG#MPWW8h'((83<#+; !7"#CflE[\\<=%:2>'=*rdVVVV"74:<<5"#=jenw|  EJ  @K  @K  L  L<=%: 2>'=*rdVVVV
&"4  GP  Q  Q  R  R  R	 O O O888
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOsO   AM; AM; 
AM;  AM; <AM;  AM; -M; 2FM; ;
OAOOONr]   r^   r_   r   r`   r4   r2   rs   rs      s(        4O 4O 4O 4O 4Or4   rs   c                       e Zd Zd ZdS )userEmailVerificationc                    	 t          | j        j                  }t          |           |                    d          d         }t
          j                            ||                                          }d|_	        t                      |_        t          j                            |d           |                                 t          j                            d|j        z   dz   |j        z   d	z   d
           t%          |d          S # t&          $ r)}t          |           t%          |d          cY d }~S d }~ww xY w)Nr   )rw   r   Tr   useramountzA new user  z! has been registered successfullynew_usermessagetypezemail_verified_success.html)r-   rN   pathrV   splitr   r(   rR   rS   r}   generate_strip_iduser_stripe_id
UserWalletr   r   AdminNotificationsru   rv   r   rU   )rX   rN   r   
user_emailuser_objr[   s         r2   rP   zuserEmailVerification.get   sF   8
dl
 
 4;;;

3#:l!!*$!OOUUWW8 $8.008(!444==???$$}X=P/PQT/TU]Ug/g  iL  0L  R\$  ]  ]  ]
6
7
77	 8 8 8888
6
7
77777778s   DD 
ED<6E<ENr\   r`   r4   r2   r   r      s#        8 8 8 8 8r4   r   c                       e Zd Zd ZdS )	userLoginc           	         	 |j                             d          }|s(t          t          j        ddt          j                  S |j                             d          }|s(t          t          j        ddt          j                  S t
          j                            |d                                          }t
          j                            |d          	                                }|d	k    r(t          t          j        d
dt          j                  S |j        d	k    r(t          t          j        ddt          j                  S |j
        (t          t          j        ddt          j                  S t
          j                            |dd          	                                }|rd                    d t          d          D                       }dt          |j                  z   dz   |z   }t          t          j                  |z   }	||_        |                                 d}
t'          dd|	i          }|}d}|}t)          j        |
|||g|           t          t          j        ddt          j                  S t
          j                            |dd          	                                }|s(t          t          j        ddt          j                  S |j                             d          }|s(t          t          j        ddt          j                  S ||_        |                                 |j        }t1          j        |j                             d          |          }|rst5          j        |          }|j        |j        |j        |j        |j        t          |          t          |j                  d}t          t          j         d|d           S t          t          j        d!dt          j                  S # tB          $ rN}tE          |           t          t          j#        t          |          dt          j#                  cY d }~S d }~ww xY w)"Nrw   rx   rM   r   rz   r{   r   )rw   r~   r   z:This email does not exist in our database, please registerz1Account not yet activated. Please contact supportzThis account is deleted.F)rw   r}   r~   r   c                 d    g | ]-}t          j        t          j        t          j        z             .S r`   r   r   s     r2   r   z"userLogin.post.<locals>.<listcomp>   ,    ^^^qv}V%9FM%IJJ^^^r4   r   r   r   r   zuser_email_verification.htmlr   r   r   z(Please check your email for verificationTNo account founddevice_tokenzDevice token is required)user_idrw   ru   rv   r   refreshaccesszLogin SuccessfullyrI   zInvalid password)$rL   rP   r   r   r   r   r(   rR   countrS   end_dater   r   r-   rw   r
   r   r   r   r   r   r   r   rz   r   verifyr   for_userrE   ru   rv   access_tokenrT   rU   rV   rW   )rX   rN   rw   rz   r   user_statuscheck_verificationr   r   r   r   r   r   r   r   userObjr   new_passcheckrefresh_tokenallDatar[   s                         r2   r   zuserLogin.post   s   :O<G$$5
 I6#>Pcddlr  mH  I  I  I  Ilz**8
 L6#>Pfggou  pK  L  L  L  L<UQ77==??4,%%EA%>>DDFF;
aii6#>  QM  N  N  V\  Vq  r  r  r  rA6#>  QD  E  E  MS  Mh  i  i  i  i&6#>Pjkksy  tO  P  P  P  P,,5U]^,__eegg `gg^^TYZ\T]T]^^^__G/#6H6N2O2OORUUX__Hx())H4L+3("G#$BV\DZ[[L M&J	BN7M:t,WWWW6#>Pz{{  DJ  D_  `  `  `  `l!!q!QQWWYY7
 H6#>Pbcckq  lG  H  H  H  H,"">22<
 P6#>Pjkksy  tO  P  P  P  P&7
<<>>>8>',**:66x@@5 H )'22Mz]$"(M""=-..	 	G 6#5G[cjkklll6#>Pbcckq  lG  H  H  H  H	 O O O888
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOs[   AP  AP  
BP  2P  .P   DP  AP  0AP  4CP  8'P   
Q8*AQ3-Q83Q8Nr   r`   r4   r2   r   r      s(        ;O ;O ;O ;O ;Or4   r   c                       e Zd Zd ZdS )userForgetPasswordc                    |j                             d          }|s(t          t          j        ddt          j                  S t
          j                            |                                          }|s(t          t          j        ddt          j                  S t
          j                            |                                          }|rd	                    d t          d	          D                       }d
t          |j                  z   dz   |z   }t          t          j                  |z   }||_        |                                 d}t#          dd|i          }	|	}
d}|}t%          j        ||
||g|	           t          t          j        dd          S t          t          j        ddt          j                  S )Nrw   rx   rM   r   ry   zPThis email does not exist in our database, please enter the valid email address.r   c                 d    g | ]-}t          j        t          j        t          j        z             .S r`   r   r   s     r2   r   z+userForgetPassword.post.<locals>.<listcomp>$  r   r4   r   z/api-user/forgoten/r   zForgot Passwordzuser_forget_password_email.htmlr   r   r   z8Reset password link has been sent to this email address.zEmail not exists)rL   rP   r   r   r   r   r(   rR   rS   r   r   r-   rw   r
   r   forgot_password_linkr   r   r   r   rT   )rX   rN   rw   r   r   r   r   r   r   r   r   r   r   s                r2   r   zuserForgetPassword.post  s   <G$$5
 I6#>Pcddlr  mH  I  I  I  I<e,,22444
 H6#>  Qc  d  d  lr  lG  H  H  H  Hl!!!..44667 Hgg^^TYZ\T]T]^^^__G%GM(:(::S@7JHx())H4L#+G LLNNNG#$EP\G]^^L M&J	BN7M:t,WWWW6#5  HB  C  C  D  D  D6#>Pbcckq  lG  H  H  H  Hr4   Nr   r`   r4   r2   r   r     s(        H H H H Hr4   r   c                       e Zd Zd Zd ZdS )forgetPasswordVerificationc                    t          | j        j                  }t          |           |                    d          d         }t
          j                            |                                          }|j	        dk    rt          |d          S t
          j                            ||                                          }|rt          d           d}nt          d	           d
}t          |dd|i          S )Nr   r   ry   
LinkExpiryzlink-expire.html)rw   r   TrueTFalseFforgot.htmlvalid)r-   rN   r   rV   r   r   r(   rR   rS   r   r   )rX   rN   r   r   link_expiryr   r   s          r2   rP   zforgetPasswordVerification.get5  s    	T\		$+++zz#r"*##J#77==??+%55
+
,
,,\  D QQWWYY( ===55>>>5	wuo	6	66r4   c                    t          j        |j                  }|                                r|j                            d          }|j                            d          }t          | j        j                  }|	                    d          d         }t          |           t          j                            |                                          }|rU|                    |           d|_        |                                 t%          j        |d           t)          |d          S d S t)          |d	d
|i          S )Nnew_passwordconfirm_new_passwordr   ry   r   zChanged successfullyzpassword_success.htmlr   form)r"   forgetverificationPOSTis_validcleaned_datarP   r-   rN   r   r   rV   r   r(   rR   rS   set_passwordr   r   r   successr   )rX   rN   r   r   r   r   r   r   s           r2   r   zforgetPasswordVerification.postF  s"   		!',	/	/$	]]__ 9#''77<+//0FGG
dl
 
 4

3#:l!!*!55;;==8 3,'''$0H!MMOOOW4555'12223 3 -&$
8
88r4   Nr]   r^   r_   rP   r   r`   r4   r2   r   r   4  s2        7 7 7"9 9 9 9 9r4   r   c                       e Zd Zd Zd ZdS )userUpdateProfilec                 P   	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j        |j        |j        |j        |j        |j        |j        |j        |j        |j        |j        d}t          t          j        d|d          S # t6          $ rN}t9          |           t          t          j        t=          |          d
t          j                  cY d }~S d }~ww xY w)Nnullr   ;Authorization Header or Token is missing on Request HeadersHS256
algorithmsr   r   rE   r~   User does not exists.rM   r   r   zUser is inactive.)r   avatarrw   ru   rv   phone_numberadresslatitude	longitudedobgenderrH   rI   )r   stripr   AuthenticationFailedjwtdecoder
   
SECRET_KEYr   r(   rR   rS   r   r   r   rE   r   rw   ru   rv   r   addressr   r   r  r  rT   rU   rV   rW   r-   )rX   rN   tokendecodedr   r   rZ   r[   s           r2   rP   zuserUpdateProfile.getY  s    O#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*=
>
>>k_N$"( "
,_ 8$ &"4iW_``
a
aa	 O O O888
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOs&   C	E B E 
F%AF F% F%c                 >
   	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|s(t          t          j        dd
t          j                  S |j                            d          }|s(t          t          j        dd
t          j                  S |j                            d          }|s(t          t          j        dd
t          j                  S t          j	        
                    |                              |j                  }	|	r(t          t          j        dd
t          j                  S |j                            d          }
|
s(t          t          j        dd
t          j                  S |j                            d          }|s(t          t          j        dd
t          j                  S |j                            d          }|s(t          t          j        dd
t          j                  S |j                            d          }|s(t          t          j        dd
t          j                  S |j                            d          }|s(t          t          j        d d
t          j                  S t          j	        
                    |!                              |j                  }|r(t          t          j        d"d
t          j                  S |j                            d#          }|j                            d$          }||_        ||_        ||_        ||_        |
|_        ||_        ||_        ||_        ||_        d%|z   |_        |                                 |j        |j        |j        |j        |j        |j        |j        |j        |j        |j        |j        d&}t          t          j        d'|d(          S # t>          $ rN}tA          |           t          t          j!        tE          |          d
t          j!                  cY d }~S d }~ww xY w))Nr   r   r   r   r   r   r   r   r   rM   r   r   Signature has expiredru   zFirst name is requiredrv   zLast name is requiredr   zPhone number is required)r   rE   z3This phone is already associated with some account.r  zaddress is requiredr   zlatitude is requiredr   zlongitude is requiredr   zavatar is requiredrw   rx   ry   z3This email is already associated with some account.r  r  r   )r   r   rw   ru   rv   r   r  r   r   r  r  zProfile updated successfullyrI   )#r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   excluderE   ru   rv   r   rw   r  r   r   r  r  r   r   rT   rU   rV   rW   r-   )rX   rN   r	  r
  r   r   ru   rv   r   phone_checkr  r   r   r   rw   email_checkr  r  rZ   r[   s                       r2   r   zuserUpdateProfile.post|  s   MO#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB  ..:
 N6#>Phiiqw  rM  N  N  N  N|,,9
 M6#>Pghhpv  qL  M  M  M  M,"">22<
 P6#>Pjkksy  tO  P  P  P  P$$L$AAIIX[IYY; k6#>  QF  G  G  OU  Oj  k  k  k  k\i((7
 K6#>Peffnt  oJ  K  K  K  Klz**8
 L6#>Pfggou  pK  L  L  L  L|,,9
 M6#>Pghhpv  qL  M  M  M  MLX&&6
 J6#>Pdeems  nI  J  J  J  J<G$$5
 I6#>Pcddlr  mH  I  I  I  I$$U$33;;x{;KK; k6#>  QF  G  G  OU  Oj  k  k  k  k			%	 	 3LX&&6#8!8'88>88!88<8?Z8?==???k_N$"( "
,_ 8 &"4Fdltuu
v
vv	 O O O888
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOsl   C	S A"S /AS 3AS 7A"S AS AS "AS &AS *AS .A"S C2S 
TATTTNr   r`   r4   r2   r   r   X  s@        !O !O !OFNO NO NO NO NOr4   r   c                       e Zd Zd ZdS )phoneOtpVerificationc                     	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|s(t          t          j        dd
t          j                  S |j        |k    rCd|_        |                                 t          t          j        dd
t          j                  S t          t          j        dd
t          j                  S # t*          $ rN}t-          |           t          t          j        t1          |          d
t          j                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r   rM   r   r   r  otpzOTP is requiredTzOTP verified successfully.zOTP is not correct)r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   r  is_otp_verifiedr   rT   rU   rV   rW   r-   )rX   rN   r	  r
  r   r   r  r[   s           r2   r   zphoneOtpVerification.post  s=   O#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB
,

5
!
!3
 G6#>Pabbjp  kF  G  G  G  Glc#HMMOOO6#5Gcddlrl~6#>Pdeems  nI  J  J  J  J	 O O O888
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOs3   C	F% A"F% /AF% ='F% %
G=/AG82G=8G=Nr   r`   r4   r2   r  r    (        O O O O Or4   r  c                       e Zd Zd ZdS )userChangePasswordc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|s(t          t          j        dd
t          j                  S |j                            d          }|s(t          t          j        dd
t          j                  S |j                            d          }|s(t          t          j        dd
t          j                  S |                    |          dk    r(t          t          j        dd
t          j                  S ||                    |          k    r(t          t          j        dd
t          j                  S |}	|                    |	           |                                 t          t          j        dd
          S # t*          $ rN}
t-          |
           t          t          j        t1          |
          d
t          j                  cY d }
~
S d }
~
ww xY w)Nr   r   r   r   r   r   r   r   r   rM   r   r   r  old_passwordzold password is required.r   znew password is required.new_confirm_passwordz!new confirm password is required.Fz%Does not match with the old password.z(Cannot set old password as new password.zPassword Changed Successfully.)r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   check_passwordr   r   rT   rU   rV   rW   r-   )rX   rN   r	  r
  r   r   r  r   r  rz   r[   s              r2   r   zuserChangePassword.post  sM    O#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB,"">22<
 Q6#>Pklltz  uP  Q  Q  Q  Q,"">22<
 Q6#>Pklltz  uP  Q  Q  Q  Q!,**+ABB
 Y6#>Pstt  }C  }X  Y  Y  Y  Yl++u446#>Pwxx  AG  A\  ]  ]  ]  ]h55lCCCC6#>Pz{{  DJ  D_  `  `  `  `"8"""==???
&"4Ffgg
h
hh	 O O O888
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOsI   C	J  A"J  /AJ  3AJ  7A J  8A J  9AJ   
K
AKKKNr   r`   r4   r2   r  r    s(        !O !O !O !O !Or4   r  c                       e Zd Zd ZdS )userDeleteAccountc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          t          j                                        |_        |                                 t&          j	        
                    |j                  }|D ]9}t          j                                        |_        |                                 :t*          j	        
                    |j                  }|D ]9}	t          j                                        |	_        |	                                 :t,          j	        
                    |j                  }
|
D ]9}t          j                                        |_        |                                 :t.          j	        
                    |j                  }|D ]9}t          j                                        |_        |                                 :t0          j	        
                    |j                  }|D ]9}t          j                                        |_        |                                 :t          t          j        dd
          S # t4          $ rN}t7          |           t          t          j        t;          |          d
t          j                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r   rM   r   r   r  r   zAccount deleted successfully)r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   r   nowr   r   ConversationrE   ServiceProviderRatingReviewsr9   r'   	UserCardsrT   rU   rV   rW   r-   )rX   rN   r	  r
  r   r   chat_objchat
rating_objrate	trans_objtransbook_objbook	cards_objcardr[   s                    r2   r   zuserDeleteAccount.post  s=   %O#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB(,,..8==???")))==8  t%))++DMIIKKKK,4;;(+;NN:  t%))++DMIIKKKK&--8;-??9  u&**,,EN	JJLLLL")))==8  t%))++DMIIKKKK ''x{';;9  t%))++DMIIKKKK
&"4Fdee
f
ff	 O O O888
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOs&   C	L# IL# #
M;-AM60M;6M;Nr   r`   r4   r2   r  r    s(        &O &O &O &O &Or4   r  c                       e Zd Zd ZdS )getCustomerNotificationsc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          t          j	        
                    |j        d                              d          }g }|D ]B}|j        |j        |j        t)          |j                  dz   d}	|                    |	           Ct          t          j        d|d          S # t0          $ r?}
t          t          j        t5          |
          d
t          j                  cY d }
~
S d }
~
ww xY w)Nr   r   r   r   r   r   r   r   r   rM   r   r   r  T)customerrj   rk    ago)rE   r   notification_type
start_daterH   rI   )r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   CustomerNotificationsrE   rm   r   r   r   r5  rn   rT   rU   rW   r-   )rX   rN   r	  r
  r   r   
notify_objr   notifyalldatar[   s              r2   rP   zgetCustomerNotifications.get8  s   O#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB%-44hk]a4bbkklqrr:7  v
)!;F-..v5	 G NN7
6#5yX_``
a
aa	 O O O
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOs%   C	F B;F 
G4GGGNr\   r`   r4   r2   r0  r0  7  r  r4   r0  c                       e Zd Zd ZdS )deleteCustomerNotificationsc                    t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|s(t          t          j        dd
t          j                  S t"          j	        
                    |                              t'          j                               t          t          j        dd
          S )Nr   r   r   r   r   r   r   r   r   rM   r   r   r  notification_idzNotification Id is requiredr  )r   z!Notification Deleted Successfully)r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   r6  updater   r!  rT   )rX   rN   r	  r
  r   r   r=  s          r2   r   z deleteCustomerNotifications.postS  s   
"7
+
+%
]evoo")<)<		()f	g	ggJuh1gYGGG'I'l!!wq!99??AA(	 L
&"=Ofggou  pK  L  L  L  L_

)*A
B
BB\%%&788/	 R
&"=Olmmu{  vQ  R  R  R  R&&/&::AA8<>>AZZZ	!3Ehii	j	jjr4   Nr   r`   r4   r2   r;  r;  R  s(        k k k k kr4   r;  c                       e Zd Zd ZdS )HelpSupportUserc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|s(t          t          j        dd
t          j                  S |j                            d          }|s(t          t          j        dd
t          j                  S t"          j	                            |||j                   t          t          j        dd
          S # t*          $ r?}t          t          j        t/          |          d
t          j                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r   rM   r   r   r  rF   ztitle is requireddescriptionzdescription is required)rF   rB  r   z Help & Support Send Successfully)r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   HelpSupportr   rE   rT   rU   rW   r-   )	rX   rN   r	  r
  r   r   rF   rB  r[   s	            r2   r   zHelpSupportUser.poste  sE   O#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB<G$$5
 I6#>Pcddlr  mH  I  I  I  I!!-00;
 O6#>Pijjrx  sN  O  O  O  OEk(+VVV
&"4Fhii
j
jj	 O O O
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOs3   C	F6 A"F6 /AF6 3AF6 6
G? 4G:4G?:G?Nr   r`   r4   r2   r@  r@  d  s(        O O O O Or4   r@  c                       e Zd Zd ZdS )getCategoryListc                 J   	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          t          j	        
                    d          }g }|D ],}|j        |j        |j        d}	|                    |	           -t          t          j        d|d          S # t*          $ r?}
t          t          j        t/          |
          d
t          j                  cY d }
~
S d }
~
ww xY w)Nr   r   r   r   r   r   r   r   r   rM   r   r   r  Tri   rE   imagenamerH   rI   )r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   CategoryrE   rH  rI  rn   rT   rU   rW   r-   )rX   rN   r	  r
  r   r   category_objrp   catrZ   r[   s              r2   rP   zgetCategoryList.get  s   O#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB"))4)@@<8  s
&YH H
 OOH
6#5yX`aa
b
bb	 O O O
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOs%   C	E BE 
F"#4FF"F"Nr\   r`   r4   r2   rE  rE    s(        O O O O Or4   rE  c                       e Zd Zd ZdS )getSubCategoryListc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|s(t          t          j        dd
t          j                  S t"          j	        
                    |d          }|s(t          t          j        dd
t          j                  S g }|D ]=}	|	j        |	j        |	j        j        |	j        |	j        d}
|                    |
           >d|	j        j        dd}t1          |          }|                                }|d         }t          t          j        d||d          S # t6          $ r?}t          t          j        t;          |          d
t          j                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r   rM   r   r   r  main_idzMain id is requiredT)category_idrj   zNo subcategory found)rE   rP  main_category_namesub_category_namerH  google_news@699adbd41323e344848401bfb91509dade9c5831b9a3e63414b8096331a2436f)engineqapi_keynews_resultsrH   )rJ   rK   rL   rY  )r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rO   rP   SubCategoryrE   rQ  categoryrI  rH  rn   r!   get_dictrT   rU   rW   r-   )rX   rN   r	  r
  r   r   rP  sub_objsub_Datasubsub_dataparamssearchresultsrY  r[   s                   r2   rP   zgetSubCategoryList.get  s   (O#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB!%%i007
 K6#>Peffnt  oJ  K  K  K  K ''gRV'WW7
 L6#>Pfggou  pK  L  L  L  L8  s
&,+Y H OOH P 6   6__7.)<
6#5yX`p|}}
~
~~	 O O O
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOs3   C	H A"H /A
H :BH 
I4IIINr\   r`   r4   r2   rN  rN    s(        )O )O )O )O )Or4   rN  c                       e Zd Zd ZdS )getServiceProvidersc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|s(t          t          j        dd
t          j                  S t"          j	        
                    |d          }g }t$          j	                                                                        }	|D ]t}
|
j        |
j        j        dz   |
j        j        z   |
j        j        |
j        j        |
j        |
j        j        |
j        |	j        |	j        d	}|                    |           ut          t          j         d|d          S # tB          $ r?}t          t          j"        tG          |          d
t          j"                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r   rM   r   r   r  sub_service_idzSub service id is required)sub_services_idworker__is_worker_approvedr   )		worker_idworker_nameworker_imageworker_experiencepriceratings
time_takenplatform_feeadmin_commissionrH   rI   )$r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rO   rP   WorkerServicesOtherSettingsr)   rj  workerru   rv   r   
experiencern  ro  rp  rq  rr  rn   rT   rU   rW   r-   )rX   rN   r	  r
  r   r   rg  
worker_objrp   other_settingsru  rZ   r[   s                r2   rP   zgetServiceProviders.get  s   !O#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB(,,-=>>>
 R6#>Plmmu{  vQ  R  R  R  R&--kl-mm:8!)--//5577>  v!=+C/0GGM(1\}$##0'8 H OOH
6#5yX`aa
b
bb	 O O O
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOs,   C	H A"H /C&H 
I 4IIINr\   r`   r4   r2   re  re    s(        "O "O "O "O "Or4   re  c                       e Zd Zd ZdS )getServiceProvidersDetailsc           
      F   	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|s(t          t          j        dd
t          j                  S t          j	        
                    |d                                          }|j        |j        dz   |j        z   |j        |j        |j        |j        d}t0          j	        
                    |j                  }	g }
|	D ]&}|j        |j        d}|
                    |           't6          j	        
                    |          }g }|D ]c}|j        |j        |j        |j        j        dz   |j        j        z   |j        j        |j        j         |j!        d}|                    |           dtD          j	        #                                                                }|j        |j$        |j%        d}t          t          j&        d||
||j'        |d          S # tP          $ r?}t          t          j)        tU          |          d
t          j)                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r   rM   r   r   r  service_provider_idzService provider id is requiredrE   	is_workerr   )rj  rk  rl  rm  worker_emailworker_addressrj  )rE   rH  service_provider)rE   ratingreviewcustomer_namecustomer_avatarr+   
created_at)rE   rq  rr  rH   )rJ   rK   worker_data	past_workreview_datatotal_ratingsother_setting_data)+r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rO   rP   rE   ru   rv   r   rv  rw   r  WorkerWorkImagesrH  rn   r#  r  r  r   bookingr+   r5  rt  r)   rq  rr  rT   ro  rU   rW   r-   )rX   rN   r	  r
  r   r   r|  rw  r  previous_worksall_Workworkall_work
review_objreview_Datar  
all_reviewrx  r  r[   s                       r2   rP   zgetServiceProvidersDetails.get  s   4O#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB -112GHH
 W6#>Pqrr  {A  {V  W  W  W  W$$*=1$MMSSUU:'+J,@@$"-#' ; %,33jm3LL>8  t
'Z H OOH,4;;Ob;dd:; 
# 
#v
)mm[+C/0EE{).+# J z""""!)--//5577>

"/&7 
 6#5y_jw  OZ  ku  k}  Se  f  f  g  g  g	 O O O
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOs,   C	K A"K /F'K 
L !4LL L Nr\   r`   r4   r2   rz  rz    s(        5O 5O 5O 5O 5Or4   rz  c                       e Zd Zd ZdS )getServiceProviderTimeslotsc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|s(t          t          j        dd
t          j                  S t"          j	        
                    |                                          }|r0t%          j        |j                            dd                    }|}	ni }	t          t          j        d|	d          S # t.          $ r?}
t          t          j        t3          |
          d
t          j                  cY d }
~
S d }
~
ww xY w)Nr   r   r   r   r   r   r   r   r   rM   r   r   r  rj  zWorker id is requiredr  \rH   rI   )r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rO   rP   WorkerTimeSlotsjsonloadsslotsreplacerT   rU   rW   r-   )rX   rN   r	  r
  r   r   rj  check_slots	data_jsonrZ   r[   s              r2   rP   zgetServiceProviderTimeslots.get(  s2   O#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB#''449
 M6#>Pghhpv  qL  M  M  M  M!)00Y0GGMMOO; 
K-55dB??@@IHHH
6#5yX`aa
b
bb	 O O O
&"GY\]^Y_Y_``hn  iN  O  O  O  O  O  O  O  O  OOs,   C	F2 A"F2 /BF2 2
G;<4G60G;6G;Nr\   r`   r4   r2   r  r  '  s(        O O O O Or4   r  c                       e Zd Zd ZdS )addUserCardc           	         	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|st          ddit          j                  S |j        s't%                      |_        |                                 |j        r|j        }t          j        t*          _        t*          j                            ||          }|rvt2          j	                            ||d         |d         |d         |d         |d                   }|j        |j        |j        |j        |j        |j         |j!        |j"        d}	t          t          j#        d|	d          S # tH          $ r4}
t          dtK          |
          it          j&                  cY d }
~
S d }
~
ww xY w)Nr   r   r   r   r   r   r   r   r   rM   r   r   r  card_idr   card_id is required)sourcerE   	exp_monthexp_yearr2  last4)r   r  r  r  the_user_stripelast_digitsrE   r   r  r  r  r  r  
is_defaultrH   rI   )'r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   r   r   r   STRIPE_SECRET_KEYstriperX  Customercreate_sourcer$  r   rE   r   r  r  r  r  r  r  rT   rU   r-   rW   )rX   rN   r	  r
  r   r   r  
createCardcardObjr9  r[   s              r2   r   zaddUserCard.postG  s   #V#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB\i((7
 \Y 56v?Z[[[[

! /11HMMOOO %G/FN..wg.FFJ  ''Xj>NYcdoYp  {E  FP  {Q  bl  mw  bx  EO  PW  EX'  Y  YW:#!/'%	 	W 6#5yX_``
a
aa	 V V V
Is1vv&v/T
U
U
UUUUUUUVs,   C	H, AH, $DH, ,
I*6)I%I*%I*Nr   r`   r4   r2   r  r  F  s(        $V $V $V $V $Vr4   r  c                       e Zd Zd ZdS )getUserCardc           
      p   	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          t          j	        
                    |          }g }|D ]J}|j        |j        |j        |j        |j        |j        |j        |j        d}	|                    |	           Kt          t          j        d|d          S # t4          $ r4}
t          dt7          |
          it          j                  cY d }
~
S d }
~
ww xY w)Nr   r   r   r   r   r   r   r   r   rM   r   r   r  r   r  rH   rI   r   )r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   r$  rE   r   r  r  r  r  r  r  rn   rT   rU   r-   rW   )rX   rN   r	  r
  r   r   card_objrp   r.  rZ   r[   s              r2   rP   zgetUserCard.geto  s   V#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB&&h&7788  t
'||+#/	 	H OOH
6#5yX`aa
b
bb	 V V V
Is1vv&v/T
U
U
UUUUUUUVs%   C	E7 B*E7 7
F5)F0*F50F5Nr\   r`   r4   r2   r  r  n  s(        V V V V Vr4   r  c                       e Zd Zd ZdS )deleteUserCardc                 6   	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|st          ddit          j                  S t"          j	        
                    |                                          }|st          ddit          j                  S t          j        t&          _        t&          j                            |j        |j                   |                                 t          ddi          S # t4          $ r4}t          dt7          |          it          j                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r   rM   r   r   r  r  r   r  r  zNo card foundrH   )r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   r$  r  r  rX  r  delete_sourcer  r  deleterU   r-   rW   )	rX   rN   r	  r
  r   r   r  r  r[   s	            r2   r   zdeleteUserCard.post  s   V#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB\i((7
 \Y 56v?Z[[[[&&'&2288::8
 VY09TUUUU.6>	?     ??
Iy)
*
**	 V V V
Is1vv&v/T
U
U
UUUUUUUVs3   C	G AG $AG 5A$G 
H$)HHHNr   r`   r4   r2   r  r    s(        V V V V Vr4   r  c                       e Zd Zd ZdS )bookServicec                 @   	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          t                      }|j                            d          }|s(t          t          j        d	d
t          j                  S t$          j	                            |          }|s(t          t          j        dd
t          j                  S |j                            d          }	|	s(t          t          j        dd
t          j                  S t          j	        
                    |	d                                          }
|
s(t          t          j        dd
t          j                  S |j                            d          }|s(t          t          j        dd
t          j                  S |j                            d          }|s(t          t          j        dd
t          j                  S |j                            d          }|st          ddit          j                  S |j                            d          }|st          ddit          j                  S |j                            d          }|st          ddit          j                  S |j                            d          }|st          dd it          j                  S t&          j	                            |||
|||||||!
  
        }t          t          j        d"|j        d#          S # t.          $ r4}t          dt1          |          it          j                  cY d }~S d }~ww xY w)$Nr   r   r   r   r   r   r   r   r   rM   r   r   r  rg  r  zNo sub service foundrj  Worker id does not exists.r}  zNo worker foundbooking_datebooking_timebooking time does not exists.rn  r   zPrice is requiredplatform_feeszplatform_fees is requiredadmin_commission_feesz!admin_commission_fees is requiredtotal_amountztotal_amount is required)
r+   r   ru  r  r  sub_servicesrn  r  r  r  rH   )rJ   r   r+   )r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   r3   rL   rP   rZ  r'   r   rT   rE   rU   r-   rW   )rX   rN   r	  r
  r   r   r+   rg  sub_service_objrj  rw  r  r  rn  r  r  r  r+  r[   s                      r2   r   zbookService.post  s   5V#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB "":L$$%566>
 M6#>Pghhpv  qL  M  M  M  M!)---@@?
 L6#>Pfggou  pK  L  L  L  L|,,9
 R6#>Plmmu{  vQ  R  R  R  R,%%9q%AAGGII:
 G6#>Pabbjp  kF  G  G  G  G,"">22<
 R6#>Plmmu{  vQ  R  R  R  R,"">22<
 U6#>Poppx~  yT  U  U  U  U<G$$5
 XY236;VWWWW<##O44=
 `Y:;6C^____"<++,CDD
 hYBC6Kfgggg,"">22<
 _Y9:&B]^^^^"))ZXU_my  HT#%mbw  FR * S S8
&"4yV^Vabb
c
cc	 V V V
Is1vv&v/T
U
U
UUUUUUUVsg   C	O A0O =A	O AO AO (AO ,AO 08O )8O "8O 8O A
O 
P))PPPNr   r`   r4   r2   r  r    s(        6V 6V 6V 6V 6Vr4   r  c                       e Zd Zd ZdS )
payBookingc           
         	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|st          ddit          j                  S t"          j	        
                    |                                          }|st          ddit          j                  S |j                            d          }|st          ddit          j                  S t$          j	        
                    ||                                          }	|	st          ddit          j                  S t'          |	j        |	j        |j                  }
|
d         dk    rt.          j	                            t3                      ||t5          |j                  |
d         d         |
d         d         |
d         d         d         d          }d|_        |                                 t:          j	        
                    |j                                                   }t>          j	                                                                         }tC          |j"                  tC          |j#                  z   tC          |j$                  z   }|xj%        tC          |          z  c_%        |                                 d!}t5          t          j&                  }|j'        j(        }d"}|}d#|i}d$d%|d&}tS          |'          *                    |||||(          }t          dd)i          S t          d|
d         it          j                  S # tV          $ r4}t          dt5          |          it          j,                  cY d }~S d }~ww xY w)*Nr   r   r   r   r   r   r   r   r   rM   r   r   r  r+   r   booking_id is requiredr  No booking foundr  r  rE   r   No card found is requiredr   TrL   balance_transactionreceipt_urlpayment_method_detailsr   pay)r:   r   r  r   txn_idrecipet_urlpayment_modetranscation_typer  zYou got a new booking requestBooking RequestrH  booking_requestBOOKING REQUESTr   rF   r   rX  registration_idmessage_titlemessage_bodydata_messageextra_notification_kwargsrH   )-r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   r'   r$  paymentWithExistingCardr  r  r  r9   r   r;   r-   is_paidr   ServiceProviderWalletrj  rt  r)   r,   rn  rq  rr  r   FIREBASE_SERVER_KEYru  r   r   notify_single_devicerU   rW   )rX   rN   r	  r
  r   r   r+   booking_objr  r  thePaymentObjCustTransaction
wallet_objother_amountr  r   
server_keyr  r  r  r  r  resultr[   s                           r2   r   zpayBooking.post  s   6V#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB  ..:
 _Y 89&B]^^^^%,,
,;;AACC;
 YY 23F<WXXXX\i((7
 \Y 56v?Z[[[[&&'w&??EEGG8
 bY ;<VE`aaaa*8+CHDTU`Umnn=H%%%-44DZD\D\bjs~  GJ  KV  Kc  Gd  Gd  ly  z@  lA  BW  lX  er  sy  ez  {H  eI  Yf  gm  Yn  oG  YH  IO  YP  bg4  h  hOK&.55+BW5XX^^``J"*..006688L{())3|/H+I+II#lNkJlJllL\***OO-GX122J!(5O%MLW! 0% L Z000EEVe  vC  R^  my  TmE  n  nFY	*+++ Y}Y78@[\\\\	 V V V
Is1vv&v/T
U
U
UUUUUUUVsF   C	P AP $AP 58P .AP  G:P ;"P 
Q()QQQNr   r`   r4   r2   r  r    (        7V 7V 7V 7V 7Vr4   r  c                       e Zd Zd ZdS )payBookingWalletc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|st          ddit          j                  S t"          j	        
                    |                                          }|st          ddit          j                  S t$          j	        
                    |                                          }|st          ddit          j                  S t&          j	                                                                        }	t+          |j                  t+          |	j                  z   t+          |	j                  z   }
|
t+          |j                  k    rGt5          d|j                   t5          d|j                   t          ddit          j                  S t6          j	                            t;                      ||t=          |
          dd          }d|_        |                                  t+          |j                  t+          |
          z
  }||_        |                                  tB          j	        
                    |j"        j#                                                  }t+          |j                  t+          |
          z   }||_        |                                  t          ddi          S # tH          $ r4}t          dt=          |          it          j%                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r   rM   r   r   r  r+   r   r  r  r  r   zNo wallet found for this user.appointmentwalletz,You do not have sufficent balance in wallet.r  r:   r   r  r   r  r  Tru  rH   )&r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   r'   r   rt  r)   r,   rn  rq  rr  r   rV   r9   r   r;   r-   r  r   r  ru  rE   rU   rW   )rX   rN   r	  r
  r   r   r+   r  r  r  r  r  
new_walletservice_wallet_objnew_wallet_providerr[   s                   r2   r   zpayBookingWallet.post!  s   9V#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB  ..:
 _Y 89&B]^^^^%,,
,;;AACC;
 YY 23F<WXXXX ")))::@@BB:
 gY @A&Jeffff ")--//5577<k'((#l.G*H*HH\MjIkIkk<S*++++	-)***	(:$%%%Y NOX^Xstttt$,33E[E]E]ckt  HK  LX  HY  HY  iq  CH3  I  I?;J%&&\):):::!:?? .5<<kFXF[<\\bbdd/677#l:K:KK2 Iy)
*
**	 V V V
Is1vv&v/T
U
U
UUUUUUUVsA   C	N7 AN7 $AN7 5AN7 CN7 D#N7 7
O5)O0*O50O5Nr   r`   r4   r2   r  r     s(        :V :V :V :V :Vr4   r  c                       e Zd Zd ZdS )getMyBookingListc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|s(t          t          j        dd
t          j                  S |dk    rUt"          j	        
                    t%          d          t%          d          z  |d                              d          }nq|dk    r6t"          j	        
                    |dd                              d          }n5t"          j	        
                    |dd                              d          }g }|D ]}	t(          j	        
                    |	j        |	j        |	j                  }
|
rd}nd}i d|	j        d|	j        d|	j        d|	j        d |	j        j        d!z   |	j        j        z   d"|	j        j        d#|	j        j        d$|	j        j        j         d%|	j!        d&|	j        j         d'|	j"        d(|	j#        d(|	j#        d)|	j$        d*|	j%        d+|	j&        d,|	j'        |	j(        |	j)        |	j*        |d-}|+                    |            t          t          j,        d.|d/          S # tZ          $ r4}t          d0t]          |          it          j/                  cY d }~S d }~ww xY w)1Nr   r   r   r   r   r   r   r   r   rM   r   r   r  booking_typezbooking_type is requiredupcomingPending)booking_statusAcceptedT)r   r  rk   complete	Completed)r   r  r  Declined)r   r  r+   FrE   r+   rj  rk  r   rl  
service_idservice_namerg  sub_service_namer  r  r  booking_completedrn  r  )r  r  r  is_ratedrH   rI   r   )0r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   GETrP   r'   r   rm   r#  r   rj  rE   r+   ru  ru   rv   r   r  rQ  r[  rI  rh  r  r  r  r	  rn  r  r  r  r  rn   rT   rU   r-   rW   )rX   rN   r	  r
  r   r   r  r  booking_Datar  check_ratingr
  rZ   r[   s                 r2   rP   zgetMyBookingList.get`  s;   7V#G,,5mu%++--2*=*=

)*g
h
hhZx2wiHHH7Y7|"""::@@BB8
 M6#>Pghhpv  qL  M  M  M  Mo

)*A
B
BB+//.11<
 P6#>Pjkksy  tO  P  P  P  Pj  &--a	.J.J.J1]gKhKhKh.hpx  DH-  I  I  R  R  SX  Y  YKK
""&--X^i-jjsstyzzKK&--X^h-iirrsxyyK< " "w/7>>wjqj{  JQ  JT>  U  UL XXX	7:7% w "	
 7>,s2W^5MM GN) '&2 G(16 g- ,1 G( G( G( g, 2  W]!" W*#$ %:(+  H. !!!!
6#5yXdee
f
ff	 V V V
Is1vv&v/T
U
U
UUUUUUUVs,   C	L< A"L< /HL< <
M:)M5/M:5M:Nr\   r`   r4   r2   r  r  _  s(        8V 8V 8V 8V 8Vr4   r  c                       e Zd Zd ZdS )homepagec           	         	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          t          j	        
                    dd                              d          d d         }g }|D ]=}|j        |j        dz   |j        z   |j        |j        d}	|                    |	           >t,          j	        
                    d          }
g }|
D ],}|j        |j        |j        d}|                    |           -t2          j	        
                    d          }g }|D ];}|j        j        |j        j        |j        j        d}|                    |           <t6          j	                                        }g }|D ]2}|j        |j        |j        |j        d}|                    |           3t          t          j        d||||d          S # t@          $ r4}t          dtC          |          it          j"                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   User does not exist.rM   r   r   r  T)r~  rj   z-ratingsr7   r   )rE   rI  r   ro  ri   rG  )rg  r  sub_service_image)rE   banner_titlerH  r  rH   )rJ   rK   service_datafeature_datapopular_Providersbanner_Datar   )#r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rm   rE   ru   rv   r   ro  rn   rJ  rH  rI  FetaureServicesub_categoryBannerManagementr)   r  r5  rT   rU   r-   rW   )rX   rN   r	  r
  r   r   popular_providersr  poppopluar_provcategory_obj_dataservice_DatarL  service_data_allfeatured_service_objfeature_Datafeaturer  
banner_objr  bannerbanner_datar[   s                          r2   rP   zhomepage.get  s4   :V#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8
 ,F$?Sijj*, , , ,o

)*A
B
BB,,!t,TT]]^hiijlkljlm + +s6^C-z	 L \****'...EE< * *s6iX 
 ())))(0777NN<& & &w+. -2!.4 L
 %%%% (,,..:; $ $v
)(l$	 K {####
6#5$lWh  xCD D E E E 
 V V V
Is1vv&v/T
U
U
UUUUUUUVs%   C	J GJ 
K)KKKNr\   r`   r4   r2   r  r    s(        ;V ;V ;V ;V ;Vr4   r  c                       e Zd Zd ZdS )CancelBookingc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|st          ddit          j                  S |j                            d          }|st          ddit          j                  S t$          j	        
                    ||                                          }|st          ddit          j                  S t          j	                            |j        j                  }	d|_        ||_        d|_        |                                 t2          j	        
                    |                                          }
t4          j	                                                                        }t9          |j                  t9          |j                  z   t9          |j                  z   }tA          d|j                   tA          d|
j!                   tD          j	        #                    tI                      ||tK          |          dd          }t9          |
j!                  t9          |          z   }||
_!        |
                                 tL          j	        
                    |j        j                                                  }t9          |j!                  t9          |          z
  }||_!        |                                 tN          j	        #                    d|j(        z   dz   d |	!           t          dd"i          S # tR          $ r4}t          dtK          |          it          j*                  cY d }~S d }~ww xY w)#Nr   r   r   r   r   r   r   r   r  rM   r   r   r  r+   r   r  cancellation_reasonzCancellation reason is requiredr  Booking not foundr  r  r   r   r  r  refundr  r  The booking id z  has been cancelled by the user.appointment_bookingr   r   ru  rH   )+r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   HTTP_404_NOT_FOUNDr'   ru  rE   r  r*  cancelled_byr   r   rt  r)   r,   rn  rq  rr  rV   r   r9   r   r;   r-   r  WorkerNotificationsr+   rU   rW   )rX   rN   r	  r
  r   r   r+   r*  appointment_objrw  r  r  r  r  r  r  r  r[   s                     r2   r   zCancelBooking.post  s+   DT#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8
 ,F$?Sijj*, , , ,o

)*A
B
BB  ..:
 ]Y 89&B[\\\\ ))*?@@
 fY AB6Kdeeee!)00Jh0OOUUWW?
 XY 34V=VWWWW  '='@ AA:$.?!)<?&"(?")))::@@BB:!)--//5577<o+,,c,2K.L.LLSQ]QnMoMoo<,---*#$$$$,33E[E]E]ck  uD  LO  P\  L]  L]  mu  GO3  P  P?J%&&\):):::!:?? .5<<oF\F_<``ffhh/677#l:K:KK2 %%.?@Z.Z[}.}  DY  bl%  m  m  m  Iy)
*
**	 T T T
Ic!ff%V-R
S
S
SSSSSSSTs9   C	P AP $8P AP /IP 
Q )P;5Q ;Q Nr   r`   r4   r2   r(  r(    s-        ET ET ET ET ETr4   r(  c                       e Zd Zd ZdS )RescheduleBookingc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|j        d	k    rt          j        d
          |s(t          t          j        ddt          j                  S |j                            d          }|s(t          t          j        ddt          j                  S |j                            d          }|s(t          t          j        ddt          j                  S |j                            d          }|s(t          t          j        ddt          j                  S t"          j	        
                    |                                          }	t"          j	        
                    |                              ||          }
t'          |	j                  dz   }t'          t          j                  }|	j        j        }d}|}d|i}dd|d}t1          |                              |||||          }t          t          j        dd          S # t6          $ r4}t          dt'          |          it          j                  cY d }~S d }~ww xY w) Nr   r   r   r   r   r   r   r   r   r  r  rM   r   r+   zbooking id is required.r  r  r  r  )r+   )r  r  z has been rescheduled.r  rH  r  r  r  r  r  rH   r   )r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   r'   r>  r-   r+   r  ru  r   r   r  rT   rU   rW   )rX   rN   r	  r
  r   r   r+   r  r  r  r+  r   r  r  r  r  r  r  r  r[   s                       r2   r   zRescheduleBooking.post$  s7   -V#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8o

)*A
B
BB
 ,F$?Sijj*, , , ,   ..:
 ,F$?Slmm*, , , , ,"">22<
 R6#>Plmmu{  vQ  R  R  R  R,"">22<
 U6#>Poppx~  yT  U  U  U  U&---DDJJLL;"))Z)@@GGUao{G||8'((*BB7H011: '4?$=<
G  /$
 
< J///DDUd  uB  Q]  lx  SlD  m  m6 6#5yQQ
R
RR	 V V V
Is1vv&v/T
U
U
UUUUUUUVs:   C(J, +AJ, /AJ, 3AJ, 7C4J, ,
K*6)K%K*%K*Nr   r`   r4   r2   r5  r5  #  s(        .V .V .V .V .Vr4   r5  c                       e Zd Zd Zd ZdS )RefundRequestc                 $   	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|j        d	k    rt          j        d
          |s(t          t          j        ddt          j                  S |j                            d          }|s(t          t          j        ddt          j                  S t"          j	        
                    ||d                                          }|st          ddit          j                  S i d|j        d|j        d|j        d|j        d|j        j        dz   |j        j        z   d|j        j        d|j        d|j        j        d|j        d|j        d|j        d|j         d|j!        d|j"        d |j#        d!|j$        d"|j%        d#|j&        i}t          t          j'        d$|d%          S # tP          $ r4}	t          dtS          |	          it          j*                  cY d }	~	S d }	~	ww xY w)&Nr   r   r   r   r   r   r   r   r   r  r  rM   r   r+   Booking Id is requiredr  rE   r   r  r   r  rE   rj  rk  r   rl  rg  r  r  r  r  r	  rn  r  r  r  r  rH   rI   )+r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   r  rP   r'   r0  rE   r+   r   rj  ru  ru   rv   r   rh  r  rI  r  r  r  r	  rn  r  r  r  r  rT   rU   r-   rW   )
rX   rN   r	  r
  r   r   r+   r  rZ   r[   s
             r2   rP   zRefundRequest.getW  s   +V#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8o

)*A
B
BB
 ,F$?Sijj*, , , ,--:
 ,F$?Skll*, , , , %,,
([e,ffllnn;
 WY 23F<UVVVV	;>;) {" &	
 ;%0369K9UU K&- k1 05 K, K, K, k0 6 [ [.  [>!" K,#$ {"% 8( 6#5yX`aa
b
bb	 V V V
Is1vv&v/T
U
U
UUUUUUUVs3   C(I +AI /AI CI 
J)J
J
Jc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|j        d	k    rt          j        d
          |s(t          t          j        ddt          j                  S |j                            d          }|s(t          t          j        ddt          j                  S t"          j	        
                    ||d                                          }|st          ddit          j                  S t&          j	                            |t+          |j                  t+          |j                  z   t+          |j                  z   t3          j                               t6          j	                            d|j        z   dz   d           t          t          j        dd          S # t<          $ r4}t          dt?          |          it          j                   cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r   r  r  rM   r   r+   r:  r  r;  r   r  )r  refund_amountdate_processedz$A new refund request for booking id z generated.refund_bookingr   rH   )!r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   r'   r0  AdminRefundRequestr   r,   rn  r  r  r	   r   r   r+   rT   rU   r-   rW   )	rX   rN   r	  r
  r   r   r+   r  r[   s	            r2   r   zRefundRequest.post  s   V#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8o

)*A
B
BB
 ,F$?Sijj*, , , ,  ..:
 ,F$?Skll*, , , , %,,
([e,ffllnn;
 WY 23F<UVVVV$${SQ\QbMcMcdghs  iJ  eK  eK  NK  LO  P[  Pi  Lj  Lj  Nj  }A  }G  }I  }I$  J  J  J$$-ST_Tj-jkx-x  O$  P  P  P
6#5yQQ
R
RR	 V V V
Is1vv&v/T
U
U
UUUUUUUVs3   C(H9 +AH9 /AH9 B6H9 9
I7)I2,I72I7Nr   r`   r4   r2   r8  r8  V  s;        ,V ,V ,V\V V V V Vr4   r8  c                       e Zd Zd ZdS )myWalletc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|j        d	k    rt          j        d
          |s(t          t          j        ddt          j                  S t          j	        
                    |                                          }|s(t          t          j        ddt          j                  S d|j        i}|j                            d          }|st          ddit          j                  S |dk    r>t(          j	        
                    |dd                              d          d d         }	n|dk    r>t(          j	        
                    |dd                              d          d d         }	n<t(          j	        
                    |d                              d          d d         }	g }
|	D ]C}|j        |j        |j        j        |j        |j        |j        d}|
                    |           Dt          t          j        d||
d          S # t<          $ r4}t          dt?          |          it          j                   cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r   r  r  rM   r   r   zNo wallet foundr   trascation_typer   trascation_type is requiredr,  r  r   r  r  rk   r7   r  r   r  rE   r:   r+   r   r  r  rH   )rJ   rK   wallet_data
trans_data)!r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   r   r   r  rP   r0  r9   rm   rE   r:   r  r+   r  r  rn   rT   rU   r-   rW   )rX   rN   r	  r
  r   r   r  rI  rD  r)  
Trans_Datar*  rJ  r[   s                 r2   rP   zmyWallet.get  s\   +V#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8o

)*A
B
BB
 ,F$?Sijj*, , , ,")));;AACC:
 JF$?Sdeems  nI  J  J  J  J j; [__%677?
 bY =>vG`aaaa!!'..xXiq.rr{{  }B  C  C  DF  EF  DF  GII5  '..xXin.ooxxy~  AC  BC  AC  DII'..xX.VV__`effgihigijI: 
" 
"u
(*-*l." J j!!!!
6#5y_j  yC  D  D  E  E  E	 V V V
Is1vv&v/T
U
U
UUUUUUUVs3   C(J3 +AJ3 AJ3 	D)J3 3
K1=)K,&K1,K1Nr\   r`   r4   r2   rB  rB    s(        ,V ,V ,V ,V ,Vr4   rB  c                       e Zd Zd ZdS )addMoneyWalletc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|j        d	k    rt          j        d
          |s(t          t          j        ddt          j                  S |j        }|                    d          }|st          ddit          j                  S |j                            d          }|st          ddit          j                  S t"          j	        
                    ||                                          }	|	st          ddit          j                  S t%          |	j        |	j        t+          |                    }
|
d         dk    rt,          j	        
                    |j                                                  }|r2|xj        t+          |          z  c_        |                                 n!t,          j	                            ||           t          ddi          S # t6          j        j        $ r4}t          dt=          |          it          j                  cY d }~S d }~wt>          $ r4}t          dt=          |          it          j                   cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r   r  r  rM   r   r   r   zamount is requiredr  r  r  r  r   T)r   r   z"Money added to wallet successfully)!r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   r$  r  r  r  r,   r   rE   r   r   r   r  error	CardErrorr-   rU   rW   )rX   rN   r	  r
  r   r   rL   r   r  r  r  user_walletr[   s                r2   r   zaddMoneyWallet.post  s   (V#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8o

)*A
B
BB
 ,F$?Sijj*, , , ,
,4HHX6
 YY34F<WXXXX\i((7
 \Y 56v?Z[[[[&&'x&@@FFHH8
 bY ;<VE`aaaa*8+CHDTUXY_U`U`aa=H%%$++hk+BBHHJJK 3v;;&     ICD
E
EE		 L L L
Is1vv&v/J
K
K
KKKKKKK	 V V V
Is1vv&v/T
U
U
UUUUUUUVsJ   C(J +:J &8J AJ 1CJ L)K?LL)L;LLNr   r`   r4   r2   rM  rM    s(        )V )V )V )V )Vr4   rM  c                       e Zd Zd ZdS )viewAllWalletTransactionsc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|j        d	k    rt          j        d
          |s(t          t          j        ddt          j                  S |j                            d          }|st          ddit          j                  S |dk    r6t$          j	        
                    |dd                              d          }np|dk    r6t$          j	        
                    |dd                              d          }n4t$          j	        
                    |d                              d          }g }|D ]C}	|	j        |	j        |	j        j        |	j        |	j        |	j        d}
|                    |
           Dt          t          j        d|d          S # t:          $ r4}t          dt=          |          it          j                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r   r  r  rM   r   rD  r   rE  r,  r  rF  rk   r  rG  rH  rH   )rJ   rK   rJ  ) r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   r  rP   r0  r9   rm   trans_idr:   r  r+   r   r  r  rn   rT   rU   r-   rW   )rX   rN   r	  r
  r   r   rD  r)  rK  r*  rJ  r[   s               r2   rP   zviewAllWalletTransactions.get   s   $V#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8o

)*A
B
BB
 ,F$?Sijj*, , , ,[__%677?
 bY =>vG`aaaa!!'..xXiq.rr{{  }B  C  CII5  '..xXin.ooxxy~II'..xX.VV__`effI: 
" 
"u
.*-*l." J j!!!!
6#5y^hii
j
jj	 V V V
Is1vv&v/T
U
U
UUUUUUUVs+   C(H5 +8H5 $DH5 5
I3?)I.(I3.I3Nr\   r`   r4   r2   rS  rS    s(        %V %V %V %V %Vr4   rS  c                       e Zd Zd ZdS )addRatingReviewServiceProviderc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|st          t          j        dd
          S t          j	        
                    |d                                          }|st          t          j        dd
          S |j                            d          }|st          t          j        dd
          S |j                            d          }	|	st          t          j        dd
          S |j                            d          }
|
st          t          j        dd
          S t"          j	                            |
          }t$          j	                            ||	|||           t$          j	        
                    |                                          }d t$          j	        
                    |          D             }t+          |          }t-          |          t-          |          z  }||_        |                                 t          t          j        dd
          S # t4          $ r4}t          dt7          |          it          j                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r  rM   r   r   r  serviceprovider_idzservice provider id requiredr}  No service provider foundr  zrating id requiredr  review id requiredr+   r  r  )r  r  r  r   r  r  c                 6    g | ]}t          |j                  S r`   )floatr  )r   provider_objs     r2   r   z7addRatingReviewServiceProvider.post.<locals>.<listcomp>K  s5      L  L  L|*++  L  L  Lr4   rH   r   )r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   r'   r#  r   r   sumr]  ro  r   rT   rU   r-   rW   )rX   rN   r	  r
  r   r   rY  r^  r  r  r+   r  total_count
all_ratingfinal_ratingaverager[   s                    r2   r   z#addRatingReviewServiceProvider.post)  sn   )V#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8
 ,F$?Sijj*, , , ,o

)*A
B
BB(()=>>
 tF$?Sqrrsss<&&-?A&NNTTVV<
 qF$?SnoopppLX&&6
 jF$?SghhiiiLX&&6
 jF$?Sghhiii  ..:
 nF$?Skllmmm%))z)::;'..f^jrz  FQ.  S  S  S-5<<l<[[aacc; L  L@\@d@k@k  ~J@k  AK  AK  L  L  L:j//<u[1117!<
6#5yQQ
R
RR	 V V V
Is1vv&v/T
U
U
UUUUUUUVsE   C	L! AL! #AL! 47L! ,7L! $7L! DL! !
M+)MMMNr   r`   r4   r2   rW  rW  (  s(        *V *V *V *V *Vr4   rW  c                       e Zd Zd ZdS )!deleteRatingReviewServiceProviderc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|st          t          j        dd
          S t"          j	                            ||j                                                  }|st          t          j        dd
          S |                                 t          t          j        dd
          S # t*          $ r4}t          dt-          |          it          j                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r  rM   r   r   r  	review_idr[  )rE   r   zreview not foundrH   r   )r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   r#  rE   r  rT   rU   r-   rW   )	rX   rN   r	  r
  r   r   rg  r  r[   s	            r2   r   z&deleteRatingReviewServiceProvider.postW  s   V#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8
 ,F$?Sijj*, , , ,o

)*A
B
BB|,,9
 jF$?Sghhiii-599YQYQ\9]]ccee:
 hF$?Seffggg
6#5yQQ
R
RR	 V V V
Is1vv&v/T
U
U
UUUUUUUVs2   C	F) AF) #AF) 9/F) )
G'3)G"G'"G'Nr   r`   r4   r2   re  re  V  s(        V V V V Vr4   re  c                       e Zd Zd ZdS )createConverstationUserc                 
   	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|st          t          j        dd
          S t          j	        
                    |dd                                          }|st          t          j        dd
          S |j                            d          }|st          t          j        dd
          S t"          j	                            |          }	|	st          t          j        dd
          S t$          j	        
                    ||                                          }
|
r	|
j        }nt)          |j                  t)          |j                  z   t)          |j                  z   t)          |j                  z   }t/          |          }t1          j        |           d                    |          }t6          j        j        j                            |          }t$          j	                            |||	          }|j        |_        tA          j!                    |_"        |#                                 t)          |j                  t)          |j                  dz   t)          |j$                  z   t)          |j%                  d}tM          j'        |          }t6          j        j                            |j                  j(                            t)          |j                  |          }t)          |j                  t)          |j                  dz   t)          |j$                  z   t)          |j%                  d}tM          j'        |          }t6          j        j                            |j                  j(                            t)          |j                  |          }|j        |_)        |j        |_*        |#                                 |j        }t          t          j+        d|d          S # tX          $ r4}t          dt)          |          it          j-                  cY d }~S d }~ww xY w) Nr   r   r   r   r   r   r   r   r  rM   r   r   r  r|  z service provider id is required.T)rE   r~  rj   rZ  r+   zBooking id is requiredr  r+  )r  r   )friendly_name)r  r   r  r   )rE   rI  rH  )identity
attributesr   )rJ   rK   twilio_channel_sidr   ).r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   r'   r"  rn  r-   ru   rE   listr   shuffler   clientconversationsv1r   sidr   r!  last_messager   rv   r   r  dumpsparticipantsuser_twilio_idservice_provider_twilio_idrT   rU   rW   )rX   rN   r	  r
  r   r   r|  service_provider_objr+   r+  existing_conversationrn  concatinate_namessuffle_stringconversation_nameconversationconversation_objuser_attributesuser_json_attributesuser_participantservice_provider_attributes service_provider_json_attributesservice_provider_participantr[   s                           r2   r   zcreateConverstationUser.posts  s   SV#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8
 ,F$?Sijj*, , , ,o

)*A
B
BB ))*?@@
 xF$?Suvvwww,--1DQRfj-kkqqss
 qF$?Snooppp  ..:
 nF$?Skllmmm"&&*&558
 iF$?Sfgghhh (/66H\ck6llrrtt 0=.A/:;;c(BU>V>VVY\]e]hYiYiilo  qE  qH  mI  mI  I*++M
N=!!!..'	v-v..  $+22DX^fqy2{{*6*:'$,LNN!x{++3x7J3K3KC3OPST\TfPgPg3g!! O  :o66+mL$%%fc(+&&2FfGG	  (++?+B'C'C3OcOnKoKopsKstw  yM  yW  uX  uX  LX%,--" " (,z2M'N'N$#)#7mL$%%fc.122>^f__	 ! '7&:#2N2R/)< 6#5yfxyy
z
zz	 V V V
Is1vv&v/T
U
U
UUUUUUUVs?   C	T AT #AT 57T -=T +LT 
U )T;5U ;U Nr   r`   r4   r2   ri  ri  r  s-        TV TV TV TV TVr4   ri  c                       e Zd Zd ZdS )createTokenc                 :   	 |j                             d          }|st          t          j        dd          S t
          j                            |          }|st          t          j        dd          S |j        }t          t          t          t          |          }t          r*t          t                    }|                    |           t          j        j                            t                    j                                                            dd	d
          }||                                d}t          t          j        d|d          S # t0          $ r4}	t          dt3          |	          it          j                  cY d }	~	S d }	~	ww xY w)Nr   zuser id is requiredrM   r  r   )rl  )service_sidTdefaultz5You have a new message in ${CONVERSATION}: ${MESSAGE})new_message_enablednew_message_soundnew_message_template)rl  r	  zToken Created SuccessfullyrI   r   r   )rL   rP   r   r   r   r   r(   rE   r    account_sidapi_sid
api_secretchat_service_sidr   	add_grantrq  rr  rs  servicesconfigurationnotificationsr>  to_jwtrT   rU   r-   rW   )
rX   rN   r   r   rl  r	  
chat_grantnotificationr9  r[   s
             r2   r   zcreateToken.post  s   !V\i((7
 kF$?Shiijjjl'**8
 hF$?Seffgggk8{7:xHHH5  '7888J	OOJ&HMOO
FP     <<>> 7 6#5Gckrss
t
tt	 V V V
Is1vv&v/T
U
U
UUUUUUUVs)   7E =E 8C#E 
F&)FFFNr   r`   r4   r2   r  r    s(        "V "V "V "V "Vr4   r  c                       e Zd Zd ZdS )userConverstationListingc                 |   	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          t          j	        
                    |          }g }|D ]O}t           j        j                            |j                  j                            dd          }	d}
d}d}|	D ]V}|j        r&|j        }
t/          |j                  dz   }|j        }/|j        r d}
t/          |j                  dz   }|j        }W|j        |j        |j        j        dz   |j        j        z   |j        j        |j        j        |j        j        dz   |j        j        z   |j        j        |j        j        |j         j        |j         j!        |j         j"        |
||d}|#                    |           Qt          t          j$        d|d          S # tJ          $ r4}t          dtM          |          it          j'                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r  rM   r   r   r  r   desc)orderlimitr3  filer   )rE   rn  r  customer_imagecustomer_idservice_provider_nameservice_provider_imager|  r+   r  r	  ru  timemessage_dater   rI   r   )(r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   r"  rq  rr  rs  rn  r   ro  bodyr   date_createdmediarE   r   ru   rv   r   r  r  r  r	  rn   rT   rU   r-   rW   )rX   rN   r	  r
  r   r   rr  conversation_listr  r   ru  r  r  recordconversation_datar[   s                   r2   rP   zuserConverstationListing.get  s   6V#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8
 ,F$?Sijj*, , , ,o

)*A
B
BB'..h.@@=$ $0 $0|#	}\455t&t""	 
 LDL 	) 	) )[lv*++F2d(ll
, )lv*++F2d(l ?':"'2S8<;L;VV#(/$'*;FL|OlOvv+<C(9<'*#+:%-?     .////
6#5yXijj
k
kk	 V V V
Is1vv&v/T
U
U
UUUUUUUVs%   C	I= F0I= =
J;)J60J;6J;Nr\   r`   r4   r2   r  r    r  r4   r  c                       e Zd Zd Zd ZdS )enableCustomerNotificationsc                    	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j        }t          t          j        d|d          S # t"          $ r4}t          dt%          |          it          j                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r  rM   r   r   r  r   rJ   rK   notification_settingr   )r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   notification_enablerT   rU   r-   rW   rX   rN   r	  r
  r   r   r  r[   s           r2   rP   zenableCustomerNotifications.get-  s[   V#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8
 ,F$?Sijj*, , , ,o

)*A
B
BB"6
6#5yh|}}
~
~~	 V V V
Is1vv&v/T
U
U
UUUUUUUVs%   C	D AD 
E)EEEc                 :   	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|st          t          j        dd
          fS ||_        |                                 t          t          j        d|d          S # t(          $ r4}t          dt+          |          it          j                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r  rM   r   r   r  r  z notification setting is requiredr   r  r   )r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   r  r   rT   rU   r-   rW   r  s           r2   r   z enableCustomerNotifications.post@  s   V#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8
 ,F$?Sijj*, , , ,o

)*A
B
BB!,**+ABB
 yF$?Suvvwwxx"68==???
6#5yh|}}
~
~~	 V V V
Is1vv&v/T
U
U
UUUUUUUVs+   C	E AE $7E 
F&)FFFNr   r`   r4   r2   r  r  ,  s:        V V V&V V V V Vr4   r  c                       e Zd Zd ZdS )approvalPendingWorkListc                 F   	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          t          j	        
                    d|          }g }|D ]}t           j	        
                    |j        |j                  }	|	rd}
nd}
|j        |j        |j        |j        |j        j        dz   |j        j        z   |j        j        |j        |j        j        |j        |j        |j        |j        |
d}|                     |           t          t          j!        d|d          S # tD          $ r4}t          dtG          |          it          j$                  cY d }~S d }~ww xY w)Nr   r   r   r   r   r   r   r   r  rM   r   r   r  Approval_Pending)r  r   )r   r  TFr   )rE   r+   r   rj  rk  rl  rg  r  r  r  r  rn  r
  rH   rI   r   )%r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   r'   r#  r   rj  rE   r+   ru  ru   rv   r   rh  r  rI  r  r  r  rn  rn   rT   rU   r-   rW   )rX   rN   r	  r
  r   r   approval_objrp   approver  r
  rZ   r[   s                r2   rP   zapprovalPendingWorkList.getZ  s9   'V#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8
 ,F$?Sijj*, , , ,o

)*A
B
BB'..@RZb.cc<8  w/7>>wjqj{>||L XXX:%">,s2W^5MMN)-,1((,] H OOH
6#5yX`aa
b
bb	 V V V
Is1vv&v/T
U
U
UUUUUUUVs%   C	G" DG" "
H ,)HH H Nr\   r`   r4   r2   r  r  Y  s(        (V (V (V (V (Vr4   r  c                       e Zd Zd ZdS )approvalPendingWorkDetailsc                 ,   	 t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|s(t          t          j        dd
t          j                  S t"          j	        
                    ||d          }	|	s(t          t          j        dd
t          j                  S g }
|	D ]}i d|j        d|j        d|j        d|j        d|j        j        dz   |j        j        z   d|j        j        d|j        d|j        j        d|j        d|j        d|j        d|j        d|j         d|j!        d|j"        d |j#        }|
$                    |           t          t          j%        d!|
d"          S # tL          $ r4}t          d#tO          |          it          j(                  cY d }~S d }~ww xY w)$Nr   r   r   r   r   r   r   r   r  rM   r   r   r  r+   zbooking_id is required.r  r;  booking not foundrE   rj  rk  r   rl  rg  r  r  r  r  r	  rn  r  complete_imagerH   rI   r   ))r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   r  rP   r'   rE   r+   r   rj  ru  ru   rv   r   rh  r  rI  r  r  r  r	  rn  r  r  rn   rT   rU   r-   rW   )rX   rN   argskwargsr	  r
  r   r   r+   r  rp   r  rZ   r[   s                 r2   rP   zapprovalPendingWorkDetails.get  s   .V#G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8
 ,F$?Sijj*, , , ,o

)*A
B
BB--:
 (F$?Slmm&( ( ( ( %,,*H^p,qq;
 (F$?Sfgg&( ( ( (8  w
GJG&  '#	
 GN-3gn6NN W^* w. -2 W) W) W) w- '3 gm   w-!H$ OOH
6#5yX`aa
b
bb	 V V V
Is1vv&v/T
U
U
UUUUUUUVs3   C	I A"I /AI ;CI 
J)JJJNr\   r`   r4   r2   r  r    s(        /V /V /V /V /Vr4   r  c                       e Zd Zd ZdS )approvedDisapproveWorkc                 "   t          |          }||dk    s|                                dk    rt          j        d          t	          j        |t          j        dg          }|d         }t          j	        
                    |d                                          }|s(t          t          j        d	d
t          j                  S |j        dk    rt          j        d          |j                            d          }|s(t          t          j        dd
t          j                  S |j                            d          }|s(t          t          j        dd
t          j                  S t"          j	        
                    ||d                                          }|s(t          t          j        dd
t          j                  S |dk    rt          j	                            |j        j                  }	d|_        |                                 d}
t-          t          j                  }|j        j        }d}|
}d|
i}dd|
d}t3          |                              |||||          }t6          j	                            d |j        z   d!z   d"|	#           nt          j	                            |j        j                  }	d$|_        |                                 d%}
t-          t          j                  }|j        j        }d&}|
}d|
i}d'd(|
d}t3          |                              |||||          }t6          j	                            d |j        z   d)z   d"|	#           t          t          j        d*d
          S )+Nr   r   r   r   r   r   r   r   r  rM   r   r   r  final_statuszfinal_status is requiredr+   r  r  r;  r  approvedr  r  z@Your booking completion is approved successfully by the customerzBooking Completion ApprovedrH  booking_completed_approvedzBOOKING COMPLETED APPROVEDr  r  r  r-  z, has been approved successfully by the user.r.  r/  r   z6Your booking completion is disapproved by the customerzBooking Completion Disapprovedbooking_completed_disapprovedzBOOKING COMPLETED DISAPPROVEDz" has been disapproved by the user.rH   )r   r  r   r  r  r  r
   r  r   r(   rR   rS   r   r   r   rL   rP   r'   ru  rE   r  r   r-   r  r   r   r  r2  r   r+   rT   )rX   rN   r	  r
  r   r   r  r+   r  rw  r   r  r  r  r  r  r  r  s                     r2   r   zapprovedDisapproveWork.post  s   #G,,5mu%++--2*=*=

)*g
h
hhZx2yIII7Y7l!!Wa!88>>@@8
 ,F$?Sijj*, , , ,o

)*A
B
BB,"">22<
 ,F$?Smnn*, , , ,   ..:
 (F$?Skll&( ( ( (  '..Jh`r.ssyy{{;
 (F$?Sfgg&( ( ( ( j  !!{'9'<!==J!,KPGX122J!(5O1MLW! ;0 L Z000EEVe  vC  R^  my  TmE  n  nF&&/@AW/W  YG  0G  Mb  ku&  v  v  v  v !!{'9'<!==J!*KFGX122J!(5O4MLW! >3 L Z000EEVe  vC  R^  my  TmE  n  nF&&/@AW/WX|/|  CX  ak&  l  l  l
6#5yQQ
R
RRr4   Nr   r`   r4   r2   r  r    s-        BS BS BS BS BSr4   r  )yrest_framework.viewsr   rest_framework.responser   rest_frameworkr   user_panel.modelsr   r   r	   django.confr
   passlib.hashr   r   r  admin_panel.modelsrest_framework.authenticationr   r  rest_framework_simplejwt.tokensr   !rest_framework_simplejwt.backendsr   django.core.mailr   r   django.shortcutsr   r   r   django.corer   django.template.loaderr   mathpytzr   django.contribr   admin_panel.functionsdjango.utils.timesincer   django.db.modelsr   r   ast	functionspyfcmr   csvtwilio.jwt.access_token.grantsr   r   r   twilio.restr   twilio.jwt.access_tokenr    serpapir!   r   r"   TWILIO_ACCOUNT_SIDr  TWILIO_AUTH_TOKEN
auth_tokenTWILIO_CHAT_SIDr  TWILIO_SYNC_SIDsync_service_sidTWILIO_API_SIDr  TWILIO_API_SECRETr  rq  r3   r;   r=   rb   rg   rs   r   r   r   r   r   r  r  r  r0  r;  r@  rE  rN  re  rz  r  r  r  r  r  r  r  r  r  r(  r5  r8  rB  rM  rS  rW  re  ri  r  r  r  r  r  r  r`   r4   r2   <module>r     s   ( ( ( ( ( ( , , , , , , ! ! ! ! ! !      " " " " " " " "             8 8 8 8 8 8          B B B B B B 



 8 8 8 8 8 8 : : : : : : 3 3 3 3 3 3 % % % % % % : : : : : : : : : :       3 3 3 3 3 3 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! # # # # # # # # # # , , , , , ,                   



     ! ! ! ! ! ! 



         
       / / / / / /                   ('
+ + 

!&
	Z	(	(     O O O O Ow O O O*O O O O O O O O"O O O O O O O O(5O 5O 5O 5O 5O7 5O 5O 5Ot8 8 8 8 8G 8 8 8(<O <O <O <O <O <O <O <O~H H H H H H H H6"9 "9 "9 "9 "9 "9 "9 "9HrO rO rO rO rO rO rO rOjO O O O O7 O O O8"O "O "O "O "O "O "O "OH'O 'O 'O 'O 'O 'O 'O 'OTO O O O Ow O O O6k k k k k' k k k$O O O O Og O O O6O O O O Og O O O8*O *O *O *O *O *O *O *OZ#O #O #O #O #O' #O #O #OJ6O 6O 6O 6O 6O 6O 6O 6OtO O O O O' O O O>%V %V %V %V %V' %V %V %VPV V V V V' V V V@V V V V VW V V V<7V 7V 7V 7V 7V' 7V 7V 7Vr8V 8V 8V 8V 8V 8V 8V 8Vv;V ;V ;V ;V ;Vw ;V ;V ;V~9V 9V 9V 9V 9Vw 9V 9V 9Vx<V <V <V <V <Vw <V <V <V~FT FT FT FT FTG FT FT FTR/V /V /V /V /V /V /V /VfIV IV IV IV IVG IV IV IVX-V -V -V -V -Vw -V -V -V`*V *V *V *V *VW *V *V *VZ&V &V &V &V &V &V &V &VR+V +V +V +V +VW +V +V +V\V V V V V V V V8UV UV UV UV UVg UV UV UVr#V #V #V #V #V' #V #V #VL8V 8V 8V 8V 8Vw 8V 8V 8Vv)V )V )V )V )V' )V )V )VZ)V )V )V )V )Vg )V )V )VX0V 0V 0V 0V 0V 0V 0V 0VhCS CS CS CS CSW CS CS CS CS CSr4   