
    wh                     N    d dl mZmZ d dlmZ d dlmZ d dlmZ  G d de      Z	y)    )	BaseModelField)Optional)Decimal)
MatchInputc            
       j   e Zd ZU  edd      Zee   ed<    edd      Zee   ed<    edd	      Z	ee   ed
<   dZ
ee   ed<   dZee   ed<    edd      Zee   ed<   dZee   ed<   dZee   ed<    edd      Zee   ed<   dZee   ed<   dZee   ed<    edd      Zee   ed<    edd      Zee   ed<    edd      Zee   ed<    edd      Zee   ed<   dZee   ed<   dZee   ed <   dZee   ed!<   d"Zee   ed#<    G d$ d%      Zed,d&ed'ed#ed(d fd)       Zd(efd*Zd(efd+Z y)-MatchOutputNwineDbId)defaultalias
wine_db_id?wineIdwine_idunknownwineName	wine_namematch errors
bottleSizebottle_sizevintageprice	taxStatus
tax_statusurldescriptionkeywordStringkeyword_stringoriginalKeywordStringoriginal_keyword_stringhistoryStringhistory_stringoriginalHistoryStringoriginal_history_stringsku|	delimiter
input_text\|input_delimiterc                       e Zd ZdZdZy)MatchOutput.ConfigTN)__name__
__module____qualname__allow_population_by_field_nameorm_mode     ]/var/www/html/wine-match-dev/backend/winematch-backend/src/apps/match/schemas/match_output.pyConfigr.      s    )-&r5   r7   match_inputoutputreturnc                     | |j                   |j                  |j                  |j                  |j                  |j
                  |j                  |j                  |j                  |j                  |j                  ||      S )N)r   r   r   r   r   r   r    r"   r$   r&   r'   r*   r,   )sizer   r   r   r   r   keyword_textoriginal_keyword_texthistory_textoriginal_history_textr'   )clsr8   r9   r,   s       r6   
from_inputzMatchOutput.from_input    st    #((''##"--#//&33$/$E$E&33$/$E$E+
 	
r5   c                    | j                   xs d| j                  xs d| j                  xs d| j                  xs d| j                  xs d| j
                  xs d| j                  t        | j                        nd| j                  xs d| j                  xs d| j                  xs d| j                  xs d| j                  xs d| j                  xs d| j                         g}| j                  j!                  |      S )z
        Returns the formatted match output string.
        Order:
        Wine Id|Wine Name|Match|Errors|Bottle Size|Vintage|Price|Tax Status|URL|Retailer Description|Keyword String|History String|SKU|Input Data
        r   )r   r   r   r   r   r   r   strr   r   r   r"   r&   r'   _get_original_inputr)   join)selffieldss     r6   
get_outputzMatchOutput.get_output2   s     LLBNN bJJ"KK2"LLB#zz5C

O2OO!rHHN"((.B((.BHHN$$&
  ~~""6**r5   c                     | j                   r2| j                  r&	 | j                   j                  | j                        S | j                   xs dS # t
        $ r | j                   cY S w xY w)Nr   )r*   r,   splitr)   rF   	Exception)rG   s    r6   rE   zMatchOutput._get_original_inputJ   s]    ??t33',,T-A-ABB $"$  '&'s   $A A'&A')r+   )!r/   r0   r1   r   r   r   rD   __annotations__r   r   r   r   r   r   r   r   r   r   r   r    r"   r$   r&   r'   r)   r*   r,   r7   classmethodr   rB   rI   rE   r4   r5   r6   r	   r	      s    %d* EJE"3h?GXc]?$YjIIx}I$E8C=$FHSM!&r!FK#FGXc]#E8G# %b DJDC#!#K##$)"O$LNHSML-22E\-]Xc]]$)"O$LNHSML-22E\-]Xc]]C#"Ix}" "J"%*OXc]*  
Z 
 
s 
_l 
 
"+C +0%S %r5   r	   N)
pydanticr   r   typingr   decimalr   "src.apps.match.schemas.match_inputr   r	   r4   r5   r6   <module>rS      s    %   9K%) K%r5   