Ë
    I»j–  ã                   ó\   — d Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
 ddlmZ  G d„ d«      Zy)	z7AI-assisted reference check questionnaires and reports.é    )Úuuid4)Ú	JobStatus)ÚReferenceQuestionÚReferenceQuestionnaireRequestÚReferenceQuestionnaireResponseÚReferenceReportRequestÚReferenceReportResponse)Úgenerate_jsonc                   ó,   — e Zd Zdedefd„Zdedefd„Zy)ÚReferenceChecksServiceÚpayloadÚreturnc              ƒ   óÄ  ‡K  — d}d‰j                   › d‰j                  › d‰j                  › d‰j                  › d‰j                  › �
}dt
        fˆfd„}t        |||¬	«      ƒ d {  –—† \  }}}t        |j                  d
«      xs g «      D ��	cg c]x  \  }}	t        |	t
        «      rc|	j                  d«      rRt        t        |	j                  dd|› �«      «      t        |	j                  dd«      «      |	j                  d«      ¬«      ‘Œz }
}}	t        ‰j                  ‰j                   t        t        «       «      t        j                   |d|› �|
¬«      S 7 Œñc c}	}w ­w)NzSCreate referee questionnaire. Return JSON: {"questions":[{"id","text","category"}]}úCandidate: ú
Role: z
JD: z
Relationship: z
Count: r   c                  óà   •— dd‰j                   › d�fdddddd	d
d‰j                  › d�fg} t        | d ‰j                   «      D ���cg c]  \  }\  }}d|dz   › �||dœ‘Œ }}}}d|iS c c}}}w )NÚperformancezHow would you rate z's performance in their role?)Ú	strengthsz7What are this person's greatest professional strengths?)Úgrowthz#Where should they focus for growth?)Úcollaborationz0How effectively do they collaborate with others?)Úreliabilityz3Can you describe their reliability under deadlines?)Ú
leadershipz/Have they demonstrated ownership or leadership?)Úrehirez.Would you rehire or work with them again? Why?Úrole_fitzHow well would they fit a z role?úrq-é   ©ÚidÚtextÚcategoryÚ	questions)Úcandidate_idÚ
role_titleÚ	enumerateÚcount)ÚbaseÚiÚcatr   Úqsr   s        €ú7/var/www/html/TJ-AI/tj/app/services/reference_checks.pyÚlocalz3ReferenceChecksService.questionnaire.<locals>.local   s¬   ø€ àÐ"5°g×6JÑ6JÐ5KÐKhÐ iÐjØXØAØUØVØQØLØÐ9¸'×:LÑ:LÐ9MÈVÐTÐUð	ˆDô '0°°_°w·}±}Ð0EÔ&Fõá&F‘N�A‘{˜˜Tð ˜Q ™U˜G�}¨dÀÓDØ&Fð ò ð   Ð$Ð$ùô	s   ÁA)©ÚsystemÚuserÚlocal_factoryr!   r   r   r   Ú r    r   zReference questionnaire via )Úcorrelation_idr"   Úquestionnaire_idÚstatusÚstubÚmessager!   )r"   r#   Újob_descriptionÚreferee_relationshipr%   Údictr
   r$   ÚgetÚ
isinstancer   Ústrr   r1   r   r   Ú	SUCCEEDED)Úselfr   r-   r.   r+   Údatar4   Úproviderr'   Úqr!   s    `         r*   Úquestionnairez$ReferenceChecksService.questionnaire   sm  øè ø€ ð?ð 	ð
 ˜'×.Ñ.Ð/¨x¸×8JÑ8JÐ7Kð LØ×*Ñ*Ð+Ð+;¸G×<XÑ<XÐ;Yð ZØ—m‘m�_ð&ð 	ð	%”tõ 	%ô" &3Ø °Eô&
÷  
Ñˆˆd�Hô " $§(¡(¨;Ó"7Ò"=¸2Ô>ô
ñ ?‘��1Ü˜!œTÔ" q§u¡u¨V¤}ô Ü�q—u‘u˜T S¨¨ 9Ó-Ó.Ü˜Ÿ™˜v rÓ*Ó+ØŸ™˜zÓ*öð
 ?ð 	ñ 
ô .Ø"×1Ñ1Ø ×-Ñ-Ü ¤£›\Ü×&Ñ&ØØ2°8°*Ð=Øô
ð 	
ð 
úó
ùs&   ƒA#E Á&EÁ')E ÂA=EÄAE ÅE c              ƒ   ó  ‡K  — d}d‰j                   › d‰j                  › d‰j                  › �}dt        fˆfd„}t	        |||¬«      ƒ d {  –—† \  }}}t        ‰j                  ‰j                   t        t        «       «      t        j                  |d|› �|j                  d	«      t        |j                  d
«      xs g «      t        |j                  d«      xs g «      |j                  d«      |j                  d«      ¬«      S 7 Œ¹­w)Nz�Consolidate referee responses. Return JSON: {"sentiment_summary","strengths":[],"concerns":[],"recommendation","report_markdown"}r   r   z
Responses: r   c            	      óP   •— dddgdgdd‰ j                   › d‰ j                  › d�d	œS )
Nz0Overall positive with normal growth areas noted.ÚReliabilityÚCollaborationz*Limited examples of senior-scope ownershipÚproceed_with_interviewu   # Reference report â€” z

Role context: zN

Summary: referees reported solid performance with room to grow on ownership.)Úsentiment_summaryr   ÚconcernsÚrecommendationÚreport_markdown)r"   r#   )r   s   €r*   r+   z,ReferenceChecksService.report.<locals>.localP   sM   ø€ à%WØ+¨_Ð=ØIÐJØ":à-¨g×.BÑ.BÐ-Cð D%Ø%,×%7Ñ%7Ð$8ð 9cðcñ
ð 
ó    r,   zReference report via rG   r   rH   rI   rJ   )r1   r"   Ú	report_idr3   r4   r5   rG   r   rH   rI   rJ   )r"   r#   Úreferee_responsesr8   r
   r	   r1   r;   r   r   r<   r9   Úlist)r=   r   r-   r.   r+   r>   r4   r?   s    `      r*   ÚreportzReferenceChecksService.reportE   s  øè ø€ ð6ð 	ð ˜'×.Ñ.Ð/¨x¸×8JÑ8JÐ7Kð LØ!×3Ñ3Ð4ð6ð 	ð
	”tõ 	ô &3Ø °Eô&
÷  
Ñˆˆd�Hô 'Ø"×1Ñ1Ø ×-Ñ-Üœ%›'“lÜ×&Ñ&ØØ+¨H¨:Ð6Ø"Ÿh™hÐ':Ó;Ü˜4Ÿ8™8 KÓ0Ò6°BÓ7Ü˜$Ÿ(™( :Ó.Ò4°"Ó5ØŸ8™8Ð$4Ó5Ø ŸH™HÐ%6Ó7ô
ð 	
ð 
ús   ƒA	DÁDÁB:DN)	Ú__name__Ú
__module__Ú__qualname__r   r   rA   r   r	   rO   © rK   r*   r   r      s-   „ ð2
Ø4ð2
à	'ó2
ðh'
Ð$:ð '
Ð?Vô '
rK   r   N)Ú__doc__Úuuidr   Úapp.schemas.commonr   Úapp.schemas.reference_checksr   r   r   r   r	   Úapp.services.ai_generater
   r   rS   rK   r*   Ú<module>rY      s)   ðÙ =å å (÷õ õ 3÷\
ò \
rK   