o
    6k~i                     @   s  d dl mZ d dlmZ ddlmZmZ G dd dejZG dd dejZ	G d	d
 d
ejZ
G dd dejZG dd dejZG dd dejZG dd dejZG dd dejZG dd dejZG dd dejZG dd dejZG dd dejZdS )    )serializers)validate_password   )User
PlaceAdminc                   @      e Zd ZdZG dd dZdS )UserSerializerzUser Serializerc                   @   s    e Zd ZeZg dZg dZdS )zUserSerializer.Meta)idusernameemailphoneavatarroleis_verifiedlanguagethemenotifications_enabled
created_at)r	   r   r   r   N__name__
__module____qualname__r   modelfieldsread_only_fields r   r   9/var/www/newdalilibackend/backend/accounts/serializers.pyMeta       r   Nr   r   r   __doc__r   r   r   r   r   r          r   c                   @   sN   e Zd ZdZejddegdZejdddZG dd dZ	dd Z
d	d
 ZdS )UserRegistrationSerializerzUser Registration SerializerT)
write_onlyrequired
validators)r#   r$   c                   @   s   e Zd ZeZg dZdS )zUserRegistrationSerializer.Meta)r
   r   r   password	password2r   N)r   r   r   r   r   r   r   r   r   r   r      s    r   c                 C   "   |d |d krt ddi|S )Nr&   r'   Password fields didn't match.r   ValidationErrorselfattrsr   r   r   validate      z#UserRegistrationSerializer.validatec                 C   s<   | d | d}tjjdi |}|| |  |S )Nr'   r&   r   )popr   objectscreateset_passwordsave)r-   validated_datar&   userr   r   r   r3      s   


z!UserRegistrationSerializer.createN)r   r   r   r    r   	CharFieldr   r&   r'   r   r/   r3   r   r   r   r   r"      s    r"   c                   @   r   )UserProfileSerializerzUser Profile Serializerc                   @       e Zd ZeZg dZddgZdS )zUserProfileSerializer.Meta)r	   r
   r   r   r   
first_name	last_namer   r   r   	fcm_tokenr	   r
   Nr   r   r   r   r   r   (   r   r   Nr   r   r   r   r   r9   &   r!   r9   c                   @   @   e Zd ZdZejddZejdegdZejddZ	dd Z
dS )ChangePasswordSerializerzChange Password SerializerTr$   r$   r%   c                 C   r(   Nnew_passwordnew_password2r)   r*   r,   r   r   r   r/   5   r0   z!ChangePasswordSerializer.validateN)r   r   r   r    r   r8   old_passwordr   rC   rD   r/   r   r   r   r   r?   /       r?   c                   @      e Zd ZdZejddZdS )PasswordResetSerializerz!Password Reset Request SerializerTr@   Nr   r   r   r    r   
EmailFieldr   r   r   r   r   rH   ;       rH   c                   @   r>   )PasswordResetConfirmSerializerz!Password Reset Confirm SerializerTr@   rA   c                 C   r(   rB   r*   r,   r   r   r   r/   F   r0   z'PasswordResetConfirmSerializer.validateN)r   r   r   r    r   r8   tokenr   rC   rD   r/   r   r   r   r   rL   @   rF   rL   c                   @   rG   )EmailVerificationSerializerzEmail Verification SerializerTr@   NrI   r   r   r   r   rN   L   rK   rN   c                   @   s*   e Zd ZdZejddZejdddZdS )"EmailVerificationConfirmSerializerz%Email Verification Confirm SerializerTr@      r$   
max_lengthN)	r   r   r   r    r   rJ   r   r8   coder   r   r   r   rO   Q       rO   c                   @   rG   )PhoneVerificationSerializerzPhone Verification SerializerTr@   N)r   r   r   r    r   r8   r   r   r   r   r   rU   W   rK   rU   c                   @   s*   e Zd ZdZejddZejdddZdS )"PhoneVerificationConfirmSerializerz%Phone Verification Confirm SerializerTr@   rP   rQ   N)r   r   r   r    r   r8   r   rS   r   r   r   r   rV   \   rT   rV   c                   @   s*   e Zd ZdZejddZejdddZdS )GoogleLoginSerializerzGoogle OAuth Login SerializerTr@   F)r$   allow_blankN)r   r   r   r    r   r8   id_tokenaccess_tokenr   r   r   r   rW   b   rT   rW   c                   @   s6   e Zd ZdZeddZejdddZG dd dZ	dS )	PlaceAdminSerializerzPlace Admin SerializerT)	read_onlyz
place.name)sourcer\   c                   @   r:   )zPlaceAdminSerializer.Meta)	r	   r7   place
place_namecan_manage_bookingscan_manage_reviewscan_manage_offerscan_manage_place_infor   r	   r   N)r   r   r   r   r   r   r   r   r   r   r   r   m   s    r   N)
r   r   r   r    r   r7   r   r8   r_   r   r   r   r   r   r[   h   s
    
r[   N)rest_frameworkr   'django.contrib.auth.password_validationr   modelsr   r   ModelSerializerr   r"   r9   
Serializerr?   rH   rL   rN   rO   rU   rV   rW   r[   r   r   r   r   <module>   s    		