
    Ѯh#                     X    d dl mZmZmZ d dlmZmZmZ  ed      Z G d dee         Z	y)    )ExplainMetricsExplainOptionsQueryExplainError)ListOptionalTypeVarTc                   j     e Zd ZdZ	 	 d	dedee   dee   f fdZe	dee   fd       Z
defdZ xZS )
QueryResultsLista\  A list of received query results from the query call.

    This is a subclass of the built-in list. A new property `explain_metrics`
    is added to return the query profile results.

    Args:
        docs (list):
            The list of query results.
        explain_options
            (Optional[:class:`~google.cloud.firestore_v1.query_profile.ExplainOptions`]):
            Options to enable query profiling for this query. When set,
            explain_metrics will be available on the returned generator.
        explain_metrics (Optional[ExplainMetrics]):
            Query profile results.
    docsexplain_optionsexplain_metricsc                 |    t         |   |       ||t        d      ||t        d      || _        || _        y )Nz=If explain_options is set, explain_metrics must be non-empty.z;If explain_options is empty, explain_metrics must be empty.)super__init__
ValueError_explain_options_explain_metrics)selfr   r   r   	__class__s       y/home/www/academy-backend.kofcorporation.com/venv/lib/python3.12/site-packages/google/cloud/firestore_v1/query_results.pyr   zQueryResultsList.__init__+   s^     	 &?+BO  $)DM  !0 /    returnc                     | j                   S )z8Query profiling options for getting these query results.)r   r   s    r   r   z QueryResultsList.explain_options@   s     $$$r   c                 v    | j                   t        d      | j                  t        d      | j                  S )a@  
        Get the metrics associated with the query execution.
        Metrics are only available when explain_options is set on the query. If
        ExplainOptions.analyze is False, only plan_summary is available. If it is
        True, execution_stats is also available.
        :rtype: :class:`~google.cloud.firestore_v1.query_profile.ExplainMetrics`
        :returns: The metrics associated with the query execution.
        :raises: :class:`~google.cloud.firestore_v1.query_profile.QueryExplainError`
            if explain_metrics is not available on the query.
        z!explain_options not set on query.z8explain_metrics is empty despite explain_options is set.)r   r   r   r   s    r   get_explain_metricsz$QueryResultsList.get_explain_metricsE   sF       (#$GHH""*#J  (((r   )NN)__name__
__module____qualname____doc__r   r   r   r   r   propertyr   r   __classcell__)r   s   @r   r   r      sg    & 5948	00 ".10 ".1	0* %.!9 % %)^ )r   r   N)
'google.cloud.firestore_v1.query_profiler   r   r   typingr   r   r   r	   r    r   r   <module>r'      s0     + *CL=)tAw =)r   