
    Rkh                        d dl mZ d dlmZ d dlmZmZmZmZ d dl	m
Z
 d dlmZ d dl d dlmZmZmZmZmZ d dlmZ d d	lmZ d d
lmZ  eddg      Zej7                  ded       ee       edd      fde
dee   fd       Zej7                  ded       ee       edd       edd       edd       ed d d       fde
d!ed"ee   d#ee   d$ee   f
d%       Z ej7                  d&ed'       ee       edd(      fde
d)efd*       Z!ej7                  d+ed,       ee       edd-      fde
d.efd/       Z"ejG                  d0ed1       ee      fd2e$de
fd3       Z%y)4    )Optional)UUID)	APIRouterDependsQuerystatus)Session)ResponseModel)*)get_keyword_matchespopulate_retailersproducer_noisesave_matched
wine_noise)get_db)	constants)MAX_PER_PAGE zWine Validation)prefixtagsz/populate-retailerszPopulate Retailers)response_modelsummaryNz&Comma-separated list of retailer codes)defaultdescriptiondbcodesc                    K   |r|j                  d      nd}t        | |       d{   }t        |t        j                  dd      S 7 !w)z
    Populate Retailers.
    ,N)r   r   Tz Retailers populated successfullydatastatus_codesuccessmessage)splitr   r
   r   HTTP_200_OK)r   r   	retailerss      e/var/www/html/wine-match-dev/backend/winematch-backend/src/apps/wine/validation/routers/validation.pypopulate_retailers_endpointr(      sK      !&EKK4E(Be<<IF$6$6Np  =s   &AA
"Az/keyword-matcheszGet Keyword Matches.zKeyword to search for matches)r   zRetailer code to filter matchesFz"Whether to narrow down the matcheszOffset for pagination)r   ger   retailer_codematched_filteris_narrowedoffsetc                 x   K   t        | ||||       d{   }t        |t        j                  dd      S 7 !w)z
    Get Keyword Matches.
    )r   r*   r+   	is_narrowr-   NTz$Keyword matches fetched successfullyr   )r   r
   r   r%   )r   r*   r+   r,   r-   matchess         r'   get_keyword_matches_endpointr1   &   sH      (]>U`io G &"4"4dLr s   :8":z/producer-noisezGet Producer Noisez%Retailer code to fetch producer noiseproducer_idc                 r   K   t        | |       d{   }t        |t        j                  dd      S 7 !w)z
    Get Producer Noise.
    )r   r2   NTz#Producer noise fetched successfullyr   )r   r
   r   r%   )r   r2   noises      r'   producer_noise_endpointr5   9   s:      !BK@@E 2 2DJo  A   75"7z/wine-noisezGet Wine Noisez!Retailer code to fetch wine noise
wine_db_idc                 r   K   t        | |       d{   }t        |t        j                  dd      S 7 !w)z
    Get Wine Noise.
    )r   r7   NTzWine noise fetched successfullyr   )r   r
   r   r%   )r   r7   r4   s      r'   wine_noise_endpointr9   F   s9      z::E 2 2DJk  ;r6   z/save-matchedzSave Matched Winepayloadc                 r   K   t        ||        d{   }t        |t        j                  dd      S 7 !w)z
    Save Matched Wine.
    )r   r:   NTzMatched wine saved successfullyr   )r   r
   r   r%   )r:   r   results      r'   save_matched_endpointr=   S   s9       2w77F!3!3TKl  8r6   )&typingr   uuidr   fastapir   r   r   r   sqlalchemy.ormr	   $src.apps.base.schemas.response_modelr
   +src.apps.wine.validation.schemas.validation,src.apps.wine.validation.services.validationr   r   r   r   r   src.core.dependenciesr   	src.utilsr   src.utils.constantsr   routergetstrr(   boolintr1   r5   r9   postSaveMatchedRequestr=        r'   <module>rQ      s     5 5 " > 9  )  ,	"$5#6	7 !-I]^&/ ;cdC= _ }F[\&/s0OP$)$De$f"'Cg"h!!?VW SM $	
 SM ]$ mEYZ&/eCMt6u		03	 [	 M-AQR&/U3Lo5p		/2	 S	 _]DWX &/


 Y
rP   