
    :iS                         d dl m Z  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 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)    )datetime)OptionalList)	BaseModelFieldfield_validator
ConfigDictc                       e Zd ZU eed<    edd      Zeed<    eddd      Zeed	<    edd
      Z	e
ed<   dZeed<    ed	      ededefd              Z ed      ededefd              Zy)ProductBasereference_id.   
min_lengthproduct_name      )r   
max_lengthbarcoder   gtmspFstatusvreturnc                 <    |j                         st        d      |S )NzBarcode must be numericisdigit
ValueErrorclsr   s     9/var/www/html/marco-python-backend/app/schemas/product.pyvalidate_barcodezProductBase.validate_barcode   s     yy{677    c                 <    |j                         rt        d      |S Nz-Product name cannot consist solely of numbersr   r   s     r!   validate_product_namez!ProductBase.validate_product_name   s     99;LMMr#   N)__name__
__module____qualname__int__annotations__r   r   strr   r   floatr   boolr   classmethodr"   r&    r#   r!   r   r      s    ca0L#0r:GS:sq!C!FDY     
 ^$c c   %r#   r   c                       e Zd Zy)ProductCreateN)r'   r(   r)   r0   r#   r!   r2   r2      s    r#   r2   c                       e Zd ZU  edd      Zee   ed<    edd      Zee	   ed<   dZ
ee   ed<    ed      ed	ee   d
ee   fd              Zy)ProductUpdateNr   r   r   r   r   r   r   r   r   c                 @    ||j                         rt        d      |S r%   r   r   s     r!   r&   z#ProductUpdate.validate_product_name%   s"     =QYY[LMMr#   )r'   r(   r)   r   r   r   r,   r+   r   r-   r   r.   r   r/   r&   r0   r#   r!   r4   r4       so    "'";L(3-; !,C%,!FHTN!^$hsm    %r#   r4   c                       e Zd ZU eed<   eed<   eed<   dZee   ed<   dZ	eed<   e
ed<   e
ed	<   e
ed
<   e
ed<   e
ed<   e
ed<   e
ed<    ed      Zy)ProductResponseid
created_at
updated_atNlast_execution_timer   violation_countprice_1_packprice_2_packprice_3_packprice_4_packprice_5_packprice_6_packprice_12_packT)from_attributes)r'   r(   r)   r*   r+   r   r;   r   r,   r<   r-   r	   model_configr0   r#   r!   r7   r7   -   sb    G)-#-OS d3Lr#   r7   c                   <    e Zd ZU ee   ed<   eed<   eed<   eed<   y)ProductListResponseitemstotalpagelimitN)r'   r(   r)   r   r7   r+   r*   r0   r#   r!   rG   rG   @   s      J
IJr#   rG   c                       e Zd ZdZy)BulkProductItemz0Schema for a single product item in bulk upload.N)r'   r(   r)   __doc__r0   r#   r!   rM   rM   G   s    :r#   rM   c                   L    e Zd ZU dZ eddd      Zee   ed<    G d d      Z	y	)
BulkProductUploadz5Schema for bulk product uploads from Excel/CSV files..   zList of products to bulk upload)	min_itemsdescriptionproductsc            	       4    e Zd Zddddddddd	d
ddddgiiZy)BulkProductUpload.ConfigexamplerT   ic;  z#COMPOSOR 3 HEPAVESICAL COMPLEX SXXI8422947152031gQ*@T)r   r   r   r   r   ie;  zCOMPOSOR 5 SEDANER C8422947152055g33333s1@N)r'   r(   r)   json_schema_extrar0   r#   r!   ConfigrV   P   sD    (-(M#2$"& ).(>#2$"&
r#   r[   N)
r'   r(   r)   rN   r   rT   r   rM   r+   r[   r0   r#   r!   rP   rP   L   s(    ?&+C1Jk&lHd?#l
 
r#   rP   c                   h    e Zd ZU dZeed<   eed<   eed<   eed<    eed      Ze	e
   ed<   eed	<   y
)BulkUploadResponsez$Response from bulk upload operation.total_processed
successfulfailedskipped_duplicateszList of errors with row info)default_factoryrS   errorsmessageN)r'   r(   r)   rN   r*   r+   r   listrc   r   dictr,   r0   r#   r!   r]   r]   g   s6    .OKtA_`FDJ`Lr#   r]   N)r   typingr   r   pydanticr   r   r   r	   r   r2   r4   r7   rG   rM   rP   r]   r0   r#   r!   <module>ri      sq     ! B B) ,	K 	
I 
4k 4&) 	k 	

	 
6 r#   