o
    ȟ1i                     @   sd  d dl mZ d dlmZmZ d dlmZ d dlmZm	Z	m
Z
mZ d dlmZ d dlmZ d dlmZmZmZmZ G dd	 d	eZG d
d deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZ G d d! d!eZ!G d"d# d#eZ"G d$d% d%eZ#d&S )'    )date)LiteralOptional)
UploadFile)	BaseModelEmailStrmodel_validator
ConfigDict)get_db)CoreValidationError)UserParentParticipantStaffc                   @   s8   e Zd ZU eed< eed< eed< eed< eddZdS )UserBaseSchema
first_name	last_nameemailmobile_numberTfrom_attributesN)__name__
__module____qualname__str__annotations__r   r	   model_config r   r   /app/schema/user.pyr      s   
 r   c                   @   sL   e Zd ZU eed< dZee ed< eed< ed ed< e	ddd	d
 Z
dS )UserCreateSchemapasswordNdobconfirm_password)parentparticipantgueststaff	user_typeaftermodec                 C   s   | j | jkr
td| jdkr| jd u rtdt .}ttttt	d}|| j }|
||j| jk dkrAtd| j W d    | S 1 sLw   Y  | S )Nzgiven passwords are mismatchr$   z-DOB is mandatory for participant registration)r#   adminr$   r%   r&   r   zAccount already exists with )r    r"   r   r'   r!   r
   r   r   r   r   querywherer   count)selfdbmodelsmodelr   r   r   validate_fields   s&   
 
z UserCreateSchema.validate_fields)r   r   r   r   r   r!   r   r   r   r   r3   r   r   r   r   r      s   
 r   c                   @   &   e Zd ZU eed< eed< eed< dS )UserLoginSchemausernamer    r'   Nr   r   r   r   r   r   r   r   r   r5   .      
 r5   c                   @   s   e Zd ZU eed< eed< eed< eed< eed< eed< eed< eed< eed	< eed
< eed< eed< eed< dZee ed< dZ	ee ed< dZ
ee ed< dS )ProfileBaseSchemasur_name
given_namer!   ageaddress	post_codelocal_authoritygenderr   emergency_contact_namesecond_emergency_contactmedical_needs	ethnicityNcare_experienceage_above_threewac_receipt)r   r   r   r   r   r   intrE   r   rF   rG   r   r   r   r   r9   4   s"   
 r9   c                   @   s   e Zd ZdS )ProfileSchemaN)r   r   r   r   r   r   r   rI   G   s    rI   c                   @   sH   e Zd ZU eed< edB ed< edB ed< eed< eed< eddZ	dS )	ProfileResponseSchemaidNprofile_imageprofile_image_urlwalletuserTr   )
r   r   r   rH   r   r   floatr   r	   r   r   r   r   r   rJ   K   s   
 rJ   c                   @   s8   e Zd ZU eed< eed< eed< edddd ZdS )	ProfileImageimageuser_idr'   r(   r)   c                 C   s    g d}| j j|vrtd| S )N)z	image/jpgz	image/pngz
image/jpegzInvalid image type)rR   content_typer   )r/   Z
valid_typer   r   r   validate_file_typeY   s   zProfileImage.validate_file_typeN)	r   r   r   r   r   rH   r   r   rU   r   r   r   r   rQ   T   s   
 rQ   c                   @   s   e Zd ZeddZdS )ProfileSchemaForParentListTr   N)r   r   r   r	   r   r   r   r   r   rV   a   s    rV   c                   @   s\   e Zd ZU eed< eed< eed< eed< eed< ee ed< dZ	ee ed< e
d	d
ZdS )ParentSchemarK   r   r   r   r   user_profileNno_of_participantTr   )r   r   r   rH   r   r   r   r   rV   rY   r	   r   r   r   r   r   rW   e   s   
 rW   c                   @   s   e Zd ZU eed< eed< eed< dZee ed< dZee ed< dZ	ee ed< dZ
ee ed< dZee ed	< d
Zee ed< dZee ed< dS )GuestProfileSchemar   r:   r   Nr=   r>   r   alternative_contact_emailalternative_phone_numberg        wallet_amountFterm_and_condition_accepted)r   r   r   r   r   r   r=   r   r>   r   r[   r\   r]   rP   r^   boolr   r   r   r   rZ   q   s   
 rZ   c                   @   s8   e Zd ZU eed< edB ed< edB ed< eddZdS )GuestResponseSchemarK   NrL   rM   Tr   )r   r   r   rH   r   r   r	   r   r   r   r   r   r`   }   s
   
 r`   c                   @   s6   e Zd ZU eed< eed< eed< eed< eed< dS )StaffProfileUpdateSchemar   r   r   r   
dbs_statusN)r   r   r   r   r   r_   r   r   r   r   ra      s   
 ra   c                   @   s   e Zd ZU eed< eed< dS )ForgotPasswordRequestr   r'   N)r   r   r   r   r   r   r   r   r   r   rc      s   
 rc   c                   @   r4   )ResetPasswordRequesttokennew_passwordr'   Nr7   r   r   r   r   rd      r8   rd   c                   @   r4   )ChangePasswordRequestZold_passwordrf   r'   Nr7   r   r   r   r   rg      r8   rg   N)$datetimer   typingr   r   fastapir   pydanticr   r   r   r	   core.configr
   core.security.exceptionsr   r1   r   r   r   r   r   r   r5   r9   rI   rJ   rQ   rV   rW   rZ   r`   ra   rc   rd   rg   r   r   r   r   <module>   s,    	