
    NRi                     |    d dl mZmZ d dlmZmZmZmZ d dlm	Z	m
Z
mZmZ d dlmZ  G d de      Z G d de      Zy	)
    )	BaseModelField)Mappedmapped_columnSessionrelationship)
ForeignKeyIntegerVARCHARText)Basec                       e Zd ZU  ed      Zedz  ed<    ed      Zedz  ed<    ed      Z	edz  ed<    ed      Z
edz  ed<    ed      Zedz  ed<    ed      Zedz  ed<    ed      Zedz  ed	<   y)
CompetitorPricingAnalysisBaseN)defaultcompetitor_idreference_competitorpricing_strategy6which_category_generates_the_most_income_for_the_store+key_observation_around_pricing_in_the_storeother_remarksgroup_id)__name__
__module____qualname__r   r   int__annotations__r   strr   r   r   r   r        R/var/www/html/retail-simulation-api/app/models/main/competitor_pricing_analysis.pyr   r      s    !&t!4MC$J4(-d(;3:;$)$$7sTz7JOX\J]:S4Z]?DT?R/#*R!&t!4MC$J4!$/HsTz/r   r   c            	          e Zd ZU dZ ededd      Zee   e	d<    ede
dd      Zee   e	d<    ede
dd      Zee   e	d<    ed	e
dd      Zee   e	d	<    ed
e
dd      Zee   e	d
<    ede
dd      Zee   e	d<    ede ed            Zee   e	d<    edd      Zedededd fd       Zedededd fd       Zededededd fd       Zedededd fd       Zy)TblCompetitorPricingAnalysistbl_competitor_pricing_analysisr   T)primary_keyautoincrementr   N)nullableserver_defaultr   r   r   r   r   ztbl_group.group_idTblGroupcompetitor_pricing_analysis)back_populatesdatadbreturnc                 x    |j                         } | di |}|j                  |       |j                          |S )Nr   )
model_dumpaddflush)clsr+   r,   	data_dictnew_datas        r    "create_competitor_pricing_analysisz?TblCompetitorPricingAnalysis.create_competitor_pricing_analysis   s5    OO%	##
x

r   competitor_get_idc                 |    |j                  |       j                  | j                  |k(        j                         }|S N)queryfilterr   first)r2   r6   r,   get_datas       r    get_competitor_pricing_analysisz<TblCompetitorPricingAnalysis.get_competitor_pricing_analysis%   s4    88C=''(9(9=N(NOUUWr   competitor_update_idc                 .   |j                  |       j                  | j                  |k(        j                         }|j	                         }|j                         D ]  \  }}|	t        |||        |j                          |j                  |       |S r8   )	r9   r:   r   r;   r/   itemssetattrcommitrefresh)r2   r>   r+   r,   update_datar3   keyvalues           r    "update_competitor_pricing_analysisz?TblCompetitorPricingAnalysis.update_competitor_pricing_analysis*   s    hhsm**3+<+<@T+TU[[]OO%	#//+JC S%0 , 			


;r   c                     |j                  |       j                  | j                  |k(        j                         }|sy|j	                  |       |j                          y)NFT)r9   r:   r   r;   deleterB   )r2   r   r,   delete_datas       r    "delete_competitor_pricing_analysisz?TblCompetitorPricingAnalysis.delete_competitor_pricing_analysis5   sL    hhsm**3+<+<+MNTTV
		+
		r   )r   r   r   __tablename__r   r
   r   r   r   r   r   r   r   r   r   r   r   r	   r   r   groupclassmethodr   r   r5   r=   rG   rK   r   r   r    r"   r"      s   5M"/VZjn"oMF3Ko)67Md]arv)w6#;w%23EtVZko%pvc{pKX  ZR  TX  cg  x|  L}:VC[  }@MN{  ~B  MQ  bf  Ag/&+  g"/PTei"jMF3Kj*:w
K_@`aHvc{a4QRE5R W^   cA   s w Rp   S Ol qx   }[   c g Qo  r   r"   N)pydanticr   r   sqlalchemy.ormr   r   r   r   
sqlalchemyr	   r
   r   r   app.models.base_classr   r   r"   r   r   r    <module>rS      s/    % D D 9 9 &0I 0,4 ,r   