
    /i                    d   d dl mZ d dlmZmZmZ d dlmZ d dlmZ d dl	m
Z
mZmZmZmZmZ  G d de
      Z G d d	e      Z G d
 de
      Z G d de
      Z G d de
      Z G d de      Z G d de
      Z G d de
      Z G d de
      Z G d de
      Z G d de
      Z G d de
      Zy)    )annotations)ListOptionalUnion)UUID)datetime)	BaseModelEmailStrFieldHttpUrl	validatorfield_validatorc                      e Zd ZU  edd      Zded<    ed      Zded<   ded<   d	Zd
ed<   dZded<    e	dd      d        Z
 e	d      d        Zy	)
VendorBase.   
min_lengthstrname
brand_namer
   emailNzOptional[HttpUrl]website_urlTbool	is_active)prec                F    t        |t              r|j                         S |S )N)
isinstancer   strip)clsvs     8/var/www/html/marco-python-backend/app/schemas/vendor.pystrip_emailzVendorBase.strip_email   s    a779    c                B    ||S t        |      }d|v rt        d      |S )N z#Website URL must not contain spaces)r   
ValueError)r   r    texts      r!   validate_websitezVendorBase.validate_website   s-    9H1v$;BCCr#   )__name__
__module____qualname__r   r   __annotations__r   r   r   r   r"   r(    r#   r!   r   r   
   sm    ca(D#(CjJ O%)K")ItwD! "
 } r#   r   c                      e Zd Zy)VendorCreateN)r)   r*   r+   r-   r#   r!   r/   r/   "   s    r#   r/   c                  @    e Zd ZU  edd      Zded<   ded<   ded<   y)	VendorUpdateNr   r   Optional[str]r   r   zOptional[bool]r   )r)   r*   r+   r   r   r,   r-   r#   r!   r1   r1   &   s    3D-3r#   r1   c                  r    e Zd ZU ded<   ded<   ded<   ded<   dZd	ed
<   ded<   dZded<   dZded<   ddiZy)	VendorOutr   idr   r   r   r
   r   Nr2   r   r   r   r   intviolation_countg        floataverage_discountfrom_attributesT)r)   r*   r+   r,   r   r7   r9   model_configr-   r#   r!   r4   r4   ,   sD    H
IOO!%K%OOS!e!%t,Lr#   r4   c                      e Zd ZU ded<   dZded<   ded<   dZded	<   dZded
<   ded<   ded<   dZded<   dZded<   ded<   ded<   ddiZ	y)ViolationOutr   r5   NOptional[UUID]	vendor_idr   product_namer2   barcode_numberreference_idr8   mspscraped_pricezOptional[float]price_differencepercentage_differencer   violation_dateurlr:   T)
r)   r*   r+   r,   r?   rA   rB   rE   rF   r;   r-   r#   r!   r=   r=   9   sa    H $I~$$(NM("&L-&	J(,o,-1?1	H%t,Lr#   r=   c                      e Zd ZU ded<   y)VendorDetailsOutzList[ViolationOut]
violationsNr)   r*   r+   r,   r-   r#   r!   rJ   rJ   I   s    ""r#   rJ   c                  6    e Zd ZU ded<   ded<   ded<   ded<   y)VendorListResponsezList[VendorOut]itemsr6   totalpage	page_sizeNrL   r-   r#   r!   rN   rN   M   s    J
INr#   rN   c                  F    e Zd ZU dZded<    edd      ed               Zy)ExportRequestNz!Optional[Union[UUID, List[UUID]]]
vendor_idsbefore)modec                .   |yt        |t              r|gS t        |t              r	 t        |      gS t        |t              r+|D cg c]  }t        |t              rt        |      n|! c}S t        d      # t        $ r t        d      w xY wc c}w )z8Normalize single UUID to list for consistent processing.NzInvalid UUID formatz*vendor_ids must be a UUID or list of UUIDs)r   r   r   r&   list)r   r    items      r!   normalize_vendor_idsz"ExportRequest.normalize_vendor_idsW   s     9a3Ja8Qy  aNOPd*T3"7DJTAPPEFF  8 !6778 Qs   A: $B:B)r)   r*   r+   rU   r,   r   classmethodr[   r-   r#   r!   rT   rT   T   s0    48J18\1G  2Gr#   rT   c                  8    e Zd ZU dZded<   dZded<   dZded<   y)ExportScrapingResultsRequestNr>   r?   Optional[int]
product_idr2   status_filter)r)   r*   r+   r?   r,   r`   ra   r-   r#   r!   r^   r^   k   s      $I~$ $J$#'M='r#   r^   c                  *    e Zd ZU dZded<   dZded<   y)ExportCombinedReportRequestNr>   r?   r_   r`   )r)   r*   r+   r?   r,   r`   r-   r#   r!   rc   rc   q   s     $I~$ $J$r#   rc   c                      e Zd ZU ded<   y)NotificationRequest
List[UUID]violation_idsNrL   r-   r#   r!   re   re   v   s    r#   re   c                      e Zd ZU ded<    edd      Zded<    edd	      Zd
ed<    edd      Zd
ed<   dddgddddiiZy)SendCustomNotificationRequestrf   rg   .zGRecipient email address (REQUIRED - email will be sent to this address))descriptionr
   recipient_emailNz<Email subject line (optional - uses default if not provided)r2   subjectz]Email message body with template variables (optional - uses default template if not provided)message_bodyjson_schema_extraexamplez$550e8400-e29b-41d4-a716-446655440000zadmin@company.comu7   Price Violation Notice – Immediate Attention Requiredz@Dear {{VENDOR_NAME}},

We have identified a pricing violation...)rg   rk   rl   rm   )	r)   r*   r+   r,   r   rk   rl   rm   r;   r-   r#   r!   ri   ri   z   s{     %c  8A  !BOX  B"RG]  #(s#L-  	"H!I#6T d	
	Lr#   ri   N)
__future__r   typingr   r   r   uuidr   r   pydanticr	   r
   r   r   r   r   r   r/   r1   r4   r=   rJ   rN   rT   r^   rc   re   ri   r-   r#   r!   <module>rt      s    " ( (   T T 0	: 	9 
-	 
--9 - #y # GI G.(9 (%) %
) I r#   