o
    û°“i'  ã                   @   sf   d dl mZmZmZmZ d dlmZ d dlmZ deeeee	ef f  dedee	ef fdd„Z
d	S )
é    )ÚAnyÚDictÚOptionalÚUnion)ÚRequest)Ú	BaseModelÚrequestÚraw_requestÚreturnc                 C   s:   d}t | tƒr|  ¡ }nt | tƒr| }||j|j|jdœS )a…  Create a structured data dictionary for JMESPath transformations.

    Extracts and organizes request data into a standardized format that can be used
    with JMESPath expressions to transform and extract specific data elements.

    :param Optional[Union[BaseModel, Dict[str, Any]]] request: Request body data - can be:
        - Pydantic BaseModel instance (will be converted to dict via model_dump())
        - Dictionary containing request data
        - None if no request body
    :param Request raw_request: The raw FastAPI request object
    :return Dict[str, Any]: Structured data with body, headers, query_params, and path_params
    N)ÚbodyÚheadersÚquery_paramsÚpath_params)Ú
isinstancer   Ú
model_dumpÚdictr   r   r   )r   r	   r   © r   új/home/ubuntu/.local/lib/python3.10/site-packages/model_hosting_container_standards/common/fastapi/utils.pyÚserialize_request   s   


ür   N)Útypingr   r   r   r   Úfastapir   Úpydanticr   Ústrr   r   r   r   r   Ú<module>   s    ÿÿ
þ