o
    7iZ                     @   s   d dl mZ d dlmZ ddlmZmZmZ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dS )    )serializers)SeniorSerializer   )CallCallLog
CallPromptVapiAssistantUserAssistantPreferencec                   @      e Zd ZdZG dd dZdS )VapiAssistantSerializerz"Serializer for VapiAssistant modelc                   @       e Zd ZeZg dZddgZdS )zVapiAssistantSerializer.Meta)idassistant_idname	is_active
created_atr   r   N)__name__
__module____qualname__r   modelfieldsread_only_fields r   r   */var/www/html/philips/calls/serializers.pyMeta	       r   Nr   r   r   __doc__r   r   r   r   r   r          r   c                   @   sB   e Zd ZdZeddZejej	j
dddddZG dd dZd	S )
!UserAssistantPreferenceSerializerz,Serializer for UserAssistantPreference modelT	read_only)r   	assistant)querysetsource
write_onlyc                   @       e Zd ZeZg dZg dZdS )z&UserAssistantPreferenceSerializer.Meta)r   userr"   r   
updated_at)r   r'   r(   N)r   r   r   r	   r   r   r   r   r   r   r   r      r   r   N)r   r   r   r   r   r"   r   PrimaryKeyRelatedFieldr   objectsfilterr   r   r   r   r   r   r      s    
r   c                   @   r
   )CallPromptSerializerzSerializer for CallPrompt modelc                   @   r&   )zCallPromptSerializer.Meta)	r   r   descriptionprompt_templater   
is_defaultr   r(   
created_by)r   r   r(   r0   N)r   r   r   r   r   r   r   r   r   r   r   r   "   s    r   Nr   r   r   r   r   r,      r   r,   c                   @   r
   )CallPromptListSerializerz*Lightweight serializer for listing promptsc                   @      e Zd ZeZg dZdS )zCallPromptListSerializer.Meta)r   r   r-   r   r/   N)r   r   r   r   r   r   r   r   r   r   r   .       r   Nr   r   r   r   r   r1   +   r   r1   c                   @   r
   )CallLogSerializerzSerializer for CallLog modelc                   @   r   )zCallLogSerializer.Meta)r   
event_typemessagedatar   r   r   N)r   r   r   r   r   r   r   r   r   r   r   r   6   s    r   Nr   r   r   r   r   r4   3   r   r4   c                   @   sL   e Zd ZdZeddZeddZeddZ	e
 Ze
 ZG dd dZdS )CallSerializerzSerializer for Call modelTr    c                   @   r&   )zCallSerializer.Meta)r   senior
twilio_sidtwilio_statusdurationformatted_durationcall_start_timecall_end_timevapi_call_idvapi_statusr"   prompt	ai_promptcall_purposeis_successfulr   r(   initiated_by)
r   r:   r;   r<   r>   r?   r@   rA   r   r(   N)r   r   r   r   r   r   r   r   r   r   r   r   G   s    r   N)r   r   r   r   r   r9   r1   rB   r   r"   r   ReadOnlyFieldr=   rE   r   r   r   r   r   r8   >   s    


r8   c                   @   s&   e Zd ZdZG dd dZdd ZdS )CallCreateSerializerz&Serializer for creating Call instancesc                   @   r2   )zCallCreateSerializer.Meta)r9   rD   rC   N)r   r   r   r   r   r   r   r   r   r   r   [   r3   r   c                 C   s    |j | jd jkrtd|S )z:Validate that the senior belongs to the authenticated userrequestz1You can only create calls for seniors you manage.)	caregivercontextr'   r   ValidationError)selfvaluer   r   r   validate_senior_   s
   z$CallCreateSerializer.validate_seniorN)r   r   r   r   r   rO   r   r   r   r   rH   X   s    rH   N)rest_frameworkr   seniors.serializersr   modelsr   r   r   r   r	   ModelSerializerr   r   r,   r1   r4   r8   rH   r   r   r   r   <module>   s    	