
    	,h                        d Z ddlmZ ddl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mZ d	d
lmZmZ  e       Zej+                  dd       ee       ee      fdededefd       Zej/                  ded       ee       ee      fdededefd       Zej/                  dee   d       ee       ee      fdededefd       Zej9                  dd       ee       ee      fdededefd       Zy)zSimulation router.    )List)	APIRouterDepends)Session)service)GroupResponse)get_db)JWTPayloadSchemaget_current_user   )SimulationCreateSimulationResponsez/simulationT)response_model_exclude_nonerequestdbtokenc                 h   K   t        j                  ||      j                  |        d{   S 7 w)zRegister the simulation.N)r   SimulationServicecreate_simulation)r   r   r   s      4/var/www/html/RetailAPI/app/api/simulation/router.pyr   r      s,      **2u5GGPPPP   )202z/simulation/{simulation_id})response_modelr   simulation_idc                 h   K   t        j                  ||      j                  |        d {   S 7 wN)r   r   get_simulationr   r   r   s      r   r   r      s*     **2u5DD]SSSSr   z"/simulation/{simulation_id}/groupssimulation_codec                 T   K   t        j                  ||      j                  |       S wr   )r   r   get_groups_by_simulation_id)r   r   r   s      r   r    r       s$     $$R.JJ?[[s   &(z"/simulation/delete/{simulation_id}c                 h   K   t        j                  ||      j                  |        d {   S 7 wr   )r   r   delete_simulationr   s      r   r"   r"      s*     **2u5GGVVVVr   N)__doc__typingr   fastapir   r   sqlalchemy.ormr   app.api.simulationr   app.api.student.schemasr   app.database.main.mysqlr	   app.dependency.authanticationr
   r   schemasr   r   simulation_routerpostr   getintr   strr    deleter"        r   <module>r4      s     & " & 1 * L 9K 4HDKFOnu  wG  oH Q%5 Q' Q[k Q IQ 4EWuyz;B6?fmn~f T T TSc T {T ;4P]K^{  AIPQWsz  |L  tM \s \w \`p \ A\ >[_`=DV_gno  hA W3 W7 WTd W aWr3   