
    Ji                     n    d dl mZmZ d dlmZmZmZmZ  G d de      Z G d de      Z	 G d de      Z
y	)
    )	BaseModelfield_validator)OptionalDictListUnionc                       e Zd ZU eed<   eed<   dZee   ed<   eed<   eed<    eddd      e	d               Z
 edd	      e	d
               Z G d d      Zy)MatchResult
field_nameprovided_valueNfound_in_documentis_match
confidencec                     |yt        |      S )z#Ensure string fields are never None )strclsvs     T/var/www/html/BankruptcyAI-uat/bankruptcy-ai/src/modules/prompt/schemas/responses.pyvalidate_stringszMatchResult.validate_strings   s     91v    before)modec                 N    |yt        |t        t        f      rt        |      S |S )zJConvert numeric values to strings (LLM sometimes returns numbers unquoted)N)
isinstanceintfloatr   r   s     r   convert_found_in_documentz%MatchResult.convert_found_in_document   s(     9a#u&q6Mr   c                       e Zd ZdZy)MatchResult.ConfigTN)__name__
__module____qualname__validate_assignment r   r   Configr!      s    "r   r'   )r"   r#   r$   r   __annotations__r   r   boolr   classmethodr   r   r'   r&   r   r   r
   r
      sy    O'+x}+NO\#3\B  C (x8  9# #r   r
   c                      e Zd ZU eed<   eed<   dZee   ed<   g Zee	e
      ed<   dZee   ed<   g Zee	e      ed<   dZee   ed<   dZee   ed	<   dZee	e      ed
<   dZee   ed<   dZee	e      ed<   dZee	e      ed<   dZee   ed<   dZee	e      ed<   dZeeee	e   f      ed<   dZee	e      ed<   dZee	eeef         ed<   dZee   ed<   dZee   ed<   eed<    G d d      Zy)AddressMatchResponsesuccessmessageNfile_urlanalysis_resultsoverall_matchmismatch_detailsis_hazydocument_type_detectedbank_statement_resultsvehicle_detailsaggregated_months_coveredaggregated_missing_monthsaggregated_months_completeoriginal_file_urlsfeedbackper_file_resultsfeedback_detailsfeedback_textoverall_feedback_text	timestampc                      e Zd Zdi dddddddd	d
d
dddddddddgdddg ddddddg dg ddddgdddddddg dgdg ddg d dd!dd"gd#g d$d%gd&gd'd(d	d)d*d+d%d,d-d+d&d.d/d+gd0d1d	d
d
dddgg dddd2gd3d4iZy5)6AddressMatchResponse.Configexampler-   Tr.   z'Name and address verification completedr/   z)http://localhost:8000/uploads/file123.jpgr0   
first_nameJohnhigh)r   r   r   r   r   cityz
Dummy Cityr1   r2   r3   Fr4   zUS Driver Licenser5   zhttps://example.com/stmt1.png)2025-05z2025-06z2025-07z2025-08z2025-09z2025-10rH   z5000.00z5100.00)monthopening_balanceclosing_balancez5234.87)r/   months_coveredmissing_monthsbalancesprovided_final_balancestatement_final_balancefinal_balance_matchesmonths_completeaccount_holder_name_matchesbank_name_matchesaccount_type_matcheserrorsr7   r8   r9   r:   zhttps://example.com/stmt2.pngr;   )rD   	last_namerG   street_namemiddle_name)fully_matchedpartially_matchednot_matchedr=   rZ   z$Exact name 'John' found on document.)fieldstatusexplanationr[   z>Street differs slightly (provided 'Street 7' vs found 'St 7').r\   z$Middle name not present on document.r<   zhttps://example.com/doc1.jpg)r/   r0   r2   r1   r3   r4   r@   z2025-11-07T10:30:00N)r"   r#   r$   json_schema_extrar&   r   r   r'   rB   :   s    H4HDH GH #&2*0-3$(&, '-*6-9$(&,%	H(  )H* #B+H, 5-H. )*=/H0 )$C*l*,&/Ibkl% 3<3<15+/7;-104"$+1HT ,-oUHV ,RWHX -dYHZ %33'[Hb %H*7$1?cHl #*oV|}+7J  \\  ]+}U{|%mHv #$B+76hn  }A  QW  X- -/)-#(2E	%wHN 2OHJ
r   r'   )r"   r#   r$   r)   r(   r   r/   r   r0   r   r
   r1   r2   r3   r4   r5   r   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r'   r&   r   r   r,   r,   $   sV   ML"Hhsm"46htK016$(M8D>(,.htCy)."GXd^",0HSM037HT$Z07&*OXd^*59xS	2959xS	29155.2c+2/3HhtCcN+,3-1htDz*17;htDcN34;#'M8C='+/8C=/NK
 K
r   r,   c                   X    e Zd ZU dZeed<   eed<   dZee   ed<   dZ	ee   ed<   eed<   y)ErrorResponseFr-   r.   Nr/   error_detailsr@   )
r"   r#   r$   r-   r)   r(   r   r/   r   rc   r&   r   r   rb   rb      s2    GTL"Hhsm"#'M8C='Nr   rb   N)pydanticr   r   typingr   r   r   r   r
   r,   rb   r&   r   r   <module>rf      s5    / . .#) #>a
9 a
HI r   