o
    y&i                     @   s   d dl mZ d dlmZ ddlmZmZmZ G dd dejZ	e
eG dd dejZe
eG d	d
 d
ejZe
eG dd dejZdS )    )admin)forms   )ConversationMemoryConversationInsightc                   @   s   e Zd ZdZG dd dZdS )ConversationAdminFormzACustom form for Conversation admin with better text field displayc                   @   s>   e Zd ZeZdZejdddddejdddddd	Zd
S )zConversationAdminForm.Meta__all__   d   z.font-family: monospace; white-space: pre-wrap;)rowscolsstyle)attrs
   zwhite-space: pre-wrap;
transcriptsummaryN)	__name__
__module____qualname__r   modelfieldsr   Textareawidgets r   r   ,/var/www/html/philips/conversations/admin.pyMeta	   s    
r   N)r   r   r   __doc__r   r   r   r   r   r      s    r   c                   @   s   e Zd ZeZg dZddgZg dZg dZdddifd	d
ddfdddifdddifddddffZ	dd Z
de
_dd Zde_dd Zde_de_dd  Zd!e_de_d"S )#ConversationAdmin)callsenior_namehas_transcripthas_summarysentiment_scoreengagement_level
created_atr%   r&   )call__senior__namer   r   )r&   
updated_atr!   call_durationzCall Informationr   )r    r!   r)   zConversation Contentr   z<Full transcript and AI-generated summary of the conversation)r   descriptionAnalysis)topics_discussedkey_memoriesemotions_detectedr$   r%   z	Follow-up)follow_up_topicsfollow_up_questions
Timestampsr&   r(   collapser   classesc                 C   s   |j r|j jr|j jjS dS )zDisplay senior nameN/A)r    seniornameselfobjr   r   r   r!   .   s   zConversationAdmin.senior_nameSeniorc                 C   s:   |j r|j jr|j jd }|j jd }| d| dS dS )zDisplay call duration<   zm sr7   )r    duration)r;   r<   minutessecondsr   r   r   r)   3   s
   zConversationAdmin.call_durationDurationc                 C      t |jo|j S )zCheck if transcript exists)boolr   stripr:   r   r   r   r"   <      z ConversationAdmin.has_transcriptzHas TranscriptTc                 C   rD   )zCheck if summary exists)rE   r   rF   r:   r   r   r   r#   B   rG   zConversationAdmin.has_summaryzHas SummaryN)r   r   r   r   formlist_displaylist_filtersearch_fieldsreadonly_fields	fieldsetsr!   short_descriptionr)   r"   booleanr#   r   r   r   r   r      sD    
r   c                   @   sZ   e Zd Zg dZg dZg dZg dZdddifddd	ifd
ddifddddffZdS )MemoryAdmin)titler8   memory_typeimportance_scoretimes_referencedr&   )rR   r&   rS   )rQ   contentsenior__name)rT   last_referencedr&   r(   zMemory Informationr   )r8   conversationrR   rQ   rU   Metadata)rS   tagszUsage Tracking)rT   rW   r1   r2   r3   r5   Nr   r   r   rI   rJ   rK   rL   rM   r   r   r   r   rP   I   s&    rP   c                   @   sP   e Zd Zg dZg dZg dZddgZdddifd	dd
ifddddffZdS )ConversationInsightAdmin)rQ   r8   insight_typeconfidence_scorer&   )r]   r&   r^   )rQ   r*   rV   r&   r(   zInsight Informationr   )r8   r]   rQ   r*   zAnalysis Data)datar^   r1   r2   r3   r5   Nr[   r   r   r   r   r\   a   s     r\   N)django.contribr   djangor   modelsr   r   r   	ModelFormr   register
ModelAdminr   rP   r\   r   r   r   r   <module>   s    6