
    HCi=                         d dl mZmZmZmZ d dlmZmZmZ  G d de      Z	 G d de	      Z
 G d de	      Z G d	 d
e      Z G d de      Z G d de	      Zy)    )	BaseModelEmailStr
ConfigDictfield_validator)ERR_PASSWORD_LENERR_PASSWORD_NUMBERERR_PASSWORD_SPECIAL_CHARc                   \    e Zd ZU dZedz  ed<   dZedz  ed<   dZedz  ed<    ed      Z	y)UserBaseN
first_name	last_namephoneforbidextra)
__name__
__module____qualname__r   str__annotations__r   r   r   model_config     B/var/www/html/story-book/Story-Book-python-api/app/schemas/user.pyr   r   	   s6    !Jd
! IsTz E3:H-Lr   r   c                   d    e Zd ZU eed<   eed<    ed      Z ed      e	dedefd              Z
y)	
UserCreateemailpasswordr   r   valuereturnc                     t        |      dk  rt        t              t        d |D              st        t              t        d |D              st        t
              |S )z6Enforce a basic password policy for new registrations.   c              3   <   K   | ]  }|j                           y wNisdigit.0cs     r   	<genexpr>z/UserCreate.validate_password.<locals>.<genexpr>        .1199;   c              3   $   K   | ]  }|d v  
 ywz!@#$%^&*(),.?:{}|<>Nr   r'   s     r   r*   z/UserCreate.validate_password.<locals>.<genexpr>        =u!1--u   len
ValueErrorr   anyr   r	   clsr   s     r   validate_passwordzUserCreate.validate_password   T     u:>-.....011=u==677r   N)r   r   r   r   r   r   r   r   r   classmethodr7   r   r   r   r   r      sC    OMH-LZ c c   !r   r   c                   "    e Zd ZdZ ed      Zy)
UserUpdatez*Schema for partial user updates via PATCH.r   r   N)r   r   r   __doc__r   r   r   r   r   r;   r;   "   s    4H-Lr   r;   c                   *    e Zd ZU eed<    ed      Zy)UserEmailChange	new_emailr   r   N)r   r   r   r   r   r   r   r   r   r   r>   r>   &   s    H-Lr   r>   c                   d    e Zd ZU eed<   eed<    ed      Z ed      ededefd              Z	y)	UserPasswordChangeold_passwordnew_passwordr   r   r   r    c                     t        |      dk  rt        t              t        d |D              st        t              t        d |D              st        t
              |S )z-Validate new password when changing password.r"   c              3   <   K   | ]  }|j                           y wr$   r%   r'   s     r   r*   z;UserPasswordChange.validate_new_password.<locals>.<genexpr>7   r+   r,   c              3   $   K   | ]  }|d v  
 ywr.   r   r'   s     r   r*   z;UserPasswordChange.validate_new_password.<locals>.<genexpr>9   r/   r0   r1   r5   s     r   validate_new_passwordz(UserPasswordChange.validate_new_password1   r8   r   N)
r   r   r   r   r   r   r   r   r9   rG   r   r   r   rA   rA   +   sE    H-L^$# #   %r   rA   c                   N    e Zd ZU dZeed<   eed<   dZedz  ed<    e	dd      Z
y)	UserReadzBRepresentation returned from API (safe, excludes hashed_password).idr   Nprofile_imageTignore)from_attributesr   )r   r   r   r<   intr   r   rK   r   r   r   r   r   r   rI   rI   =   s+    LGO $M3:$ d(CLr   rI   N)pydanticr   r   r   r   app.core.constantsr   r   r	   r   r   r;   r>   rA   rI   r   r   r   <module>rQ      s_    E E .y . $. ..i .
 $Dx Dr   