
    )i                         d dl mZ d dlmZ  G d dej                        Z G d dej                        Z G d dej                        Zy	)
    )serializers)Appointmentc                       e Zd Z ej                         Z ej                         Z ej                         Z ej                         Zd Z	d Z
d Zd Z G d d      Zy)AppointmentSerializerc                 t    |j                   r,|j                   j                  r|j                   j                  S y N)callfrom_numberselfobjs     F/var/www/html/dp2/backend_v2.1/server/apps/appointments/serializers.pyget_customer_numberz)AppointmentSerializer.get_customer_number   s(    88,,88'''    c                 t    |j                   r,|j                   j                  r|j                   j                  S y r   )r	   idr   s     r   get_call_idz!AppointmentSerializer.get_call_id   s$    8888;;r   c                 t    |j                   r,|j                   j                  r|j                   j                  S y r   )r	   call_idr   s     r   get_partner_call_idz)AppointmentSerializer.get_partner_call_id   s(    88((88###r   c                 t    |j                   r,|j                   j                  r|j                   j                  S y r   )r	   
transcriptr   s     r   get_transcriptz$AppointmentSerializer.get_transcript   s(    88++88&&&r   c                        e Zd ZeZg dZg dZy)AppointmentSerializer.Meta)r   namer   scheduled_dateofftimetwilio_call_sidpartner_call_idcustomer_number
created_atr   bot_type)r   r"   
updated_atr!   r    r   r   N)__name__
__module____qualname__r   modelfieldsread_only_fields r   r   Metar      s    
 }r   r,   N)r%   r&   r'   r   SerializerMethodFieldr    r!   r   r   r   r   r   r   r,   r+   r   r   r   r      sb    7k779O7k779O2224J/k//1G



} }r   r   c                       e Zd ZdZ ej
                   ej                  d      d      Z ej
                  d      Zy)BookAppointmentInputSerializerz
    Permissive input serializer for webhook payloads. It validates top-level
    'args' and 'call' as dicts but does not enforce strict inner schema so
    small webhook changes won't break validation.
    T)allow_blankF)childrequired)r2   N)	r%   r&   r'   __doc__r   	DictField	CharFieldargsr	   r+   r   r   r/   r/   1   s>    
 !;  '<{'<'<'NY^_D ;  %0Dr   r/   c                   .    e Zd Z ej                         Zy)WebhookSuccessSerializerN)r%   r&   r'   r   r5   messager+   r   r   r8   r8   :   s    #k##%Gr   r8   N)	rest_frameworkr   apps.appointments.modelsr   ModelSerializerr   
Serializerr/   r8   r+   r   r   <module>r>      sD    & 0)}K77 )}X1[%;%; 1&{55 &r   