o
    ȟ1i                     @   s   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
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dS )    )time)	BaseModelmodel_validator
ConfigDict)get_db)CoreValidationError)TimeSlotc                   @   s*   e Zd ZU eed< eed< dZeed< dS )TimeSlotBaseSchema
start_timeend_timeNdescription)__name__
__module____qualname__r   __annotations__r   str r   r   /app/schema/time_slot.pyr	   
   s   
 r	   c                   @   s   e Zd Zedddd ZdS )TimeSlotCreateSchemaaftermodec                 C   s|   | j | jkr
tdt '}|ttj | j ktj| jktjd 	 dkr,tdW d    | S 1 s7w   Y  | S )NzInvalid time has been chosen!r   zTime slot already exists!)
r
   r   r   r   queryr   where
deleted_atis_countselfdbr   r   r   validate_time   s   

z"TimeSlotCreateSchema.validate_timeN)r   r   r   r   r    r   r   r   r   r      s    r   c                   @   s(   e Zd ZU eed< edddd ZdS )TimeSlotUpdateSchemaidr   r   c                 C   sr   t  ,}|ttj| jktj| jktjd tj| jk	 dkr't
dW d    | S 1 s2w   Y  | S )Nr   zTime Slot already exists.)r   r   r   r   r
   r   r   r   r"   r   r   r   r   r   r   validate_fields    s   


z$TimeSlotUpdateSchema.validate_fieldsN)r   r   r   intr   r   r#   r   r   r   r   r!      s   
 r!   c                   @   s(   e Zd ZU eed< eed< eddZdS )TimeSlotResponseSchemar"   titleT)from_attributesN)r   r   r   r$   r   r   r   model_configr   r   r   r   r%   *   s   
 r%   N)datetimer   pydanticr   r   r   core.configr   core.security.exceptionsr   modelsr   r	   r   r!   r%   r   r   r   r   <module>   s    