
    ##i                     ~   d dl mZmZmZmZmZmZmZmZm	Z	 d dl
mZmZ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 d dlmZ d dlmZ erd d	lmZ  ed
ej:                   e	de ed             e	de ed                  Z edej:                   e	de ed             e	de ed                  Z G d de      Z y)    )	Integer
ForeignKeyTextFloatDateTimeBooleanStringTableColumn)relationshipMappedmapped_column)ListOptionalTYPE_CHECKING)func)Base)hybrid_property)FileResponseSchema)datetime)ProductCategoryproducts_files
product_idzproducts.idfile_idzfiles.idproducts_notesnote_idznotes.idc                      e Zd ZU dZdZ eeddd      Zee	   e
d<    ee      Zee   e
d<    eed      Zee   e
d<    eed	      Zeee      e
d
<    eed      Zee   e
d<    eed	      Zeee      e
d<    eed	      Zeee      e
d<    eed	      Zeee      e
d<    eed      Zee   e
d<    eed      Zee   e
d<    eed	      Zeee      e
d<    e ed      d      Zee   e
d<    eed      Z ee   e
d<    eed	      Z!eee      e
d<    eed	      Z"eee      e
d<    eed	      Z#eee      e
d<    eed	      Z$eee      e
d<    eed      Z%ee   e
d<    eed      Z&ee   e
d<    eed	      Z'eee      e
d<    eed	      Z(eee      e
d <    eed	      Z)eee      e
d!<    eed	      Z*eee      e
d"<    eed      Z+ee   e
d#<    eed	      Z,eee      e
d$<    eed	      Z-eee      e
d%<    eed	      Z.eee      e
d&<    eed	      Z/eee      e
d'<    eed	      Z0eee      e
d(<    ee e1jd                         )      Z3ee   e
d*<    eed e1jd                         +      Z4eee      e
d,<    eed	      Z5eee      e
d-<    ee e6d.      d	      Z7eee	      e
d/<    e8d0e7gd1d2      Z9eed0      e
d3<    e8d4d5      Z:ee;d4      e
d6<    e8d7d5      Z<ee;d7      e
d8<    ee e6d9      d	      Z=eee	      e
d:<    e8d;e=gd<      Z>eed;      e
d=<    e8d>e??      Z@ee;d>      e
d@<    e8dAeA?      ZBee;dA      e
dB<   eCdCeeD   fdD       ZEeCdCee;eD      fdE       ZFyF)GProductz5
    Product Model: ORM class for Product Entity
    productsT)primary_keyindexautoincrementidname)uniquesku)nullablecodeslug
unit_price
sale_pricedescription)default	is_activeFis_new	new_until2   product	item_typeis_purchasepurchase_msrp purchase_manufacture_part_numberpurchase_supplier_skupurchase_descriptiong        calculated_purchase_tax_rateis_sell	sell_msrpsell_manufacture_part_numbersell_supplier_skusell_descriptioncalculated_sell_tax_ratelengthheightwidthweightdepth)server_default
created_at)r'   onupdate
updated_at
deleted_atzproducts_category.idcategory_idr   joined)foreign_keyslazyuselistcategoryPaymentRequestLineItems)back_populates
line_itemsInvoiceLineItemsinvoice_line_itemszmerchants.idmerchant_idMerchant)rL   rN   merchantFile)	secondaryattachmentsNotenotesreturnc                 n    | j                   r)t        t        d | j                               }|r|d   S d S y )Nc                      | j                   dk(  S N	thumbnail	file_typexs    ^/var/www/html/hwPaymentPortal-be-dev/hw-payment-portal-api/src/apps/products/models/product.py<lambda>z#Product.thumbnail.<locals>.<lambda>p       !;     r   rZ   listfilter)selfthumbnail_datas     rf   ra   zProduct.thumbnaill   s=    !;T=M=MNN )7>!$@D@ri   c                 `    | j                   r"t        t        d | j                               }|S y )Nc                      | j                   dk7  S r`   rb   rd   s    rf   rg   z-Product.product_attachments.<locals>.<lambda>y   rh   ri   rj   )rm   
attachments     rf   product_attachmentszProduct.product_attachmentsu   s1    ;T=M=MNJ ri   N)G__name__
__module____qualname____doc____tablename__r   r   r#   r   int__annotations__r   r$   strr&   r(   r   r)   r   r*   floatr+   r,   r   r.   boolr/   r   r0   r   r	   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   r   nowrF   rH   rI   r   rJ   r   rO   rR   r   rT   rU   rW   product_attachments_maprZ   product_notes_mapr\   r   r   ra   rr    ri   rf   r   r   &   s    M#GTY]^Bs^%d+D&++$T$7C7"/t"DD&#
D%d48D&+8*7*MJx'M*7*MJx'M)6td)KK&K+GTBIvd|B(%@FF4L@,9(T,RIvhx()R*6":yIIvc{I -gu EKE-:54-PM6(5/*P>KD[_>`$fXc]&;`3@PT3U6(3-0U2?t2T&#/T2?t2T &-T)'5AGVD\A)6ut)LIvhuo&L:GW[:\ &#"7\/<TD/Qvhsm,Q.;D4.PfXc]+P.;E4.PfUmP&3ED&IFF8E?#I&3ED&IFF8E?#I%254%HE6(5/"H&3ED&IFF8E?#I%254%HE6(5/"H#0($((*#UJx U-:8d]e]a]e]e]g-hJx)*h-:8d-SJx)*S" *7w
Ka@bmq)rK&r4@He5HfX/01  ;GG`qz:{Jt567{;GHZkt;ut$678u)6w
>@Zei)jK&j-9*T_S`jo-pHfXj)*p(4VG^(_KV%_".vAR"SE6$v,S8$67   Xd3E.F%G  ri   r   N)!
sqlalchemyr   r   r   r   r   r   r	   r
   r   sqlalchemy.ormr   r   r   typingr   r   r   sqlalchemy.sqlr   src.apps.base.models.baser   sqlalchemy.ext.hybridr   "src.apps.files.schemas.file_commonr   r   3src.apps.product_categories.models.product_categoryr   metadatar~   r   r   r   ri   rf   <module>r      s   
 
 
 ? > 0 0  * 1 A SMM
<*]";<
9gz*56	  MM
<*]";<
9gz*56	 Vd Vri   