
    b6i                         d dl mZ 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y)    )Optional)	BaseModelEmailStr
ConfigDictfield_validator)ERR_PASSWORD_LENERR_PASSWORD_NUMBERERR_PASSWORD_SPECIAL_CHARc                   \    e Zd ZU dZee   ed<   dZee   ed<   dZee   ed<    e	d      Z
y)UserBaseN
first_name	last_namephoneforbidextra)__name__
__module____qualname__r   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$#Ix}#E8C=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   classmethodr8   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                   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>3   r,   r-   c              3   $   K   | ]  }|d v  
 ywr/   r   r(   s     r   r+   z;UserPasswordChange.validate_new_password.<locals>.<genexpr>5   r0   r1   r2   r6   s     r   validate_new_passwordz(UserPasswordChange.validate_new_password-   r9   r   N)
r   r   r   r   r   r   r   r   r:   rE   r   r   r   r?   r?   '   sE    H-L^$# #   %r   r?   c                   N    e Zd ZU dZeed<   eed<   dZee	   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   rI   r   r   r   r   r   r   r   rG   rG   9   s+    LGO#'M8C=' d(CLr   rG   N)typingr   pydanticr   r   r   r   app.core.constantsr   r	   r
   r   r   r<   r?   rG   r   r   r   <module>rP      sV     E E .y . $. . $Dx Dr   