
    i                     L   d Z ddlmZmZmZ ddl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mZmZ  ed
dg      Zej3                  dee          ed       ed       edd       eddd       ee       ee	       ee
      fdedz  dedz  dededededefd       Zej3                  dee          ee       ee	       ee
      fdededefd       Zej3                  d e       ee       ee	       ee
      fd!edededefd"       Zy)#u5   프로비저닝/오퍼레이션 로그 API 라우터.    )	APIRouterDependsQuery)Session)get_dbget_current_userverify_project_access)AppError)t)UserAccount)ProvenanceRecorder)OperationDetailResponseOperationLogResponseOperationSummaryz/api/v1/projects/{project_id}
operations)prefixtagsz/operations)response_modelN)default)r   ge2         )r   r   leoperation_type
episode_idoffsetlimit
project_iddbcurrent_userc                 D    t        ||      }|j                  | |||      S )z8List operation logs (paginated, filter by type/episode).)r   r   r   r   )r   get_operations)r   r   r   r   r   r    r!   recorders           K/Users/manta/Documents/Projects/TheRoad-I1/backend/app/api/v1/operations.pylist_operationsr&      s4     ""j1H""%	 #      z/operations/summaryc                 :    t        ||       }|j                         S )z(Get aggregated stats per operation type.)r   get_summary)r   r    r!   r$   s       r%   get_operations_summaryr*   +   s     ""j1H!!r'   z/operations/{op_id}op_idc                 r    t        ||      }|j                  |       }|st        dt        d      d      |S )zGet single operation detail.zoperation.not_foundi  )codemessagestatus_code)r   get_operationr
   r   )r+   r   r    r!   r$   ops         r%   r0   r0   6   sF     ""j1H				&B&+,
 	

 Ir'   ) __doc__fastapir   r   r   sqlalchemy.ormr   
OrmSessionapp.api.depsr   r   r	   app.core.errorsr
   app.i18n.loaderr   app.models.catalogr   app.modules.provenancer   app.schemas.operationr   r   r   routergetliststrintr&   r*   r0    r'   r%   <module>rB      s   ; - - 0 H H $  * 5  
*

 M$/C*DE!&t!4"40a(raC034V_ '(8 9$Jd
  	
  	  F& !$7G2HI34V_ '(8 9""" " J" !2IJ 34V_ '(8 9	 	 	 Kr'   