
    Qj                         d Z ddlmZmZmZmZmZmZmZm	Z	m
Z
mZ ddlmZ ddlmZ  G d de      Z G d de      Z G d	 d
e      Zy)u  
Modelos do módulo Full (Fulfillment do Mercado Livre).

Fase 1 (read-only): snapshot do estoque no Full por unidade de inventário,
série histórica diária e a tabela oficial de tarifas cadastrada em Settings.
O custo real derivado destas tabelas alimenta ProductFinancialMetric
(campos storage_cost / daily_storage_fee / inbound_freight_cost / storage_risk_cost),
que ads.py já consome no cálculo de margem do modal do produto.
    )
ColumnStringIntegerFloatDateTimeBooleanNumericDateJSONIndex)datetime)Basec                   |   e Zd ZdZdZ eedd      Z e ed      ddd      Z	 e ed      dd	      Z
 e ed      dd	      Z e ed      d
      Z eed      Z eed      Z eed      Z eed      Z eed
      Z eed
      Z eed
      Z eeej0                  ej0                        Zy)FullInventoryz
    Snapshot ATUAL do estoque de um item no Full. 1 linha por inventory_id.
    Alimentado por MeliApiService.get_fulfillment_stock (read-only).
    full_inventoryTprimary_keyautoincrement@   F)uniqueindexnullable   r   r   r   r   defaultr   onupdateN)__name__
__module____qualname____doc____tablename__r   r   idr   inventory_idad_idskuvariation_idavailable_qtyin_transit_qtynot_available_qty	total_qtyr   days_of_stockoldest_stock_daysr   rawr   r   utcnow
updated_at     =/var/www/hypershopcomercio.com.br/hyper-ai/app/models/full.pyr   r      s     %M	T	>B&*TNL6#;dT:E
D4
8C&*t4L7A.MGQ/Nw2w*I540Mw6

%C(//HOOTJr4   r   c                       e Zd ZdZdZ eedd      Z e ed      dd      Z	 e ed      dd      Z
 e ed      dd      Z eedd      Z eed	
      Z eed	
      Z eed	
      Z edddd      fZy)FullStockDailyuR   Série histórica diária por inventory_id — base para tendência e antiguidade.full_stock_dailyTr   r   Fr   r   r   r   ix_full_stock_daily_inv_dayr&   day)r   N)r    r!   r"   r#   r$   r   r   r%   r   r&   r(   r'   r
   r:   r*   r+   r,   r   __table_args__r3   r4   r5   r7   r7   (   s    \&M	T	>B&*D5AL
D4
8C6#;dT:E
TE
2C7A.MGQ/Nw2 	+^U4PNr4   r7   c                   X   e Zd ZdZdZ eedd      Z e ed      d      Z	 ee
d      Z ee
d      Z e ed	d
      d      Z e ed	d      d      Z eed      Z ee
d      Z eed      Z eeej,                        Z eeej,                  ej,                        Zy)FullStorageTariffu   
    Tabela oficial de tarifas do Full, cadastrada pelo usuário em Settings.
    O motor de custo casa o volume real do produto (dims do Ad) com a faixa
    e aplica daily_fee/inbound_fee + sobretaxa de estoque antigo.
    full_storage_tariffsTr   d   r   g        r   
         Z   g      @r   N)r    r!   r"   r#   r$   r   r   r%   r   namer   min_volume_lmax_volume_lr	   	daily_feeinbound_feeaged_days_thresholdaged_daily_factorr   activer   r   r1   
created_atr2   r3   r4   r5   r=   r=   ;   s    
 +M	T	>B&+-D%-L%$/Lwr1~s3IQ5K "5uc2GT*F(//:J(//HOOTJr4   r=   N)r#   
sqlalchemyr   r   r   r   r   r   r	   r
   r   r   r   app.core.databaser   r   r7   r=   r3   r4   r5   <module>rO      sD    e d d  "UD U2T &U Ur4   