
    ߶h                        d dl mZmZmZmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZmZmZ d d
lmZmZmZ  eddg      Zej9                  de
d       e        ee      fdedefd       Zej=                  de
d       ee      fdedefd       Zej=                  de
d       ee      fdedefd       Z y)    )	APIRouterDependsQuerystatus)Session)UUID)ResponseModel)	constants)get_db)MAX_PER_PAGE)Optional)check_addition_matched
undo_matchaccept_match)AdditionMatchCheckSchemaUndoMatchSchemaAcceptMatchSchema zExternal Inputs)prefixtagsz/check-addition-matchedz1Check if a wine addition has already been matched)response_modelsummarypayloaddbc                 p   K   t        ||        d{   }t        |t        j                  dd      S 7 !w)zQ
    Check if a wine with the given mongo_id already exists in the database.
    NTz#Check addition matched successfullydatastatus_codesuccessmessage)r   r	   r   HTTP_200_OKr   r   r   s      m/var/www/html/wine-match-dev/backend/winematch-backend/src/apps/wine/external_input/routers/external_input.pycheck_addition_matchr$      s;      (G44D&&5	  5   64"6z/accept-matchz+Accept the match for a given wine by its IDc                 p   K   t        ||        d{   }t        |t        j                  dd      S 7 !w)z
    Accept the match for a given wine by its ID.
    This involves updating the wine details based on the provided information.
    NTzAccept match successfullyr   )r   r	   r   r!   r"   s      r#   accept_wine_matchr'      s;      b'**D&&+	  +r%   z/undo-matchz)Undo the match for a given wine by its IDc                 p   K   t        ||        d{   }t        |t        j                  dd      S 7 !w)z
    Undo the match for a given wine by its ID.
    This involves deleting associated retailer wines, wine duplications, and the wine itself.
    NTzUndo match successfullyr   )r   r	   r   r!   r"   s      r#   undo_wine_matchr)   0   s;      B((D&&)	  )r%   N)!fastapir   r   r   r   sqlalchemy.ormr   uuidr   $src.apps.base.schemas.response_modelr	   	src.utilsr
   src.core.dependenciesr   src.utils.constantsr   typingr   3src.apps.wine.external_input.service.external_inputr   r   r   3src.apps.wine.external_input.schemas.external_inputr   r   r   routergetr$   putr'   r)        r#   <module>r9      s    5 5 "  >  ( ,  n n z z	"$5#6	7%m  NA  B(/	&/% B OMCpq &/ r  M-Alm &/ nr8   