o
    }l~i                     @  s   d 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 erJddl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 ededZG dd dee ZdS )z
.. warning::
    **Preview API**: Firestore Pipelines is currently in preview and is
    subject to potential breaking changes in future releases.
    )annotations)GenericTypeVarTYPE_CHECKING)pipeline_stages)_BasePipeline)DOCUMENT_PATH_DELIMITER)Client)AsyncClient)BaseDocumentReference)	BaseQuery)BaseAggregationQuery)BaseCollectionReferencePipelineType)boundc                   @  sT   e Zd ZdZdddZdd ZdddZdddZd ddZd!ddZ	d"ddZ
dS )#PipelineSourceaz  
    A factory for creating Pipeline instances, which provide a framework for building data
    transformation and query pipelines for Firestore.

    Not meant to be instantiated directly. Instead, start by calling client.pipeline()
    to obtain an instance of PipelineSource. From there, you can use the provided
    methods to specify the data source for your pipeline.
    clientClient | AsyncClientc                 C  s
   || _ d S N)r   )selfr    r   p/var/www/newdalilibackend/backend/venv/lib/python3.10/site-packages/google/cloud/firestore_v1/pipeline_source.py__init__0   s   
zPipelineSource.__init__c                 C  s   | j j| j |S r   )r   _pipeline_cls_create_with_stages)r   source_stager   r   r   _create_pipeline3   s   zPipelineSource._create_pipelinequery@'BaseQuery' | 'BaseAggregationQuery' | 'BaseCollectionReference'returnr   c                 C  s
   | | S )a  
        Create a pipeline from an existing query

        Queries containing a `cursor` or `limit_to_last` are not currently supported

        Args:
            query: the query to build the pipeline off of
        Raises:
            - NotImplementedError: raised if the query contains a `cursor` or `limit_to_last`
        Returns:
            a new pipeline instance representing the query
        )_build_pipeline)r   r   r   r   r   create_from6   s   
zPipelineSource.create_frompathstr | tuple[str]c                 C  s$   t |tr
t|}| t|S )a  
        Creates a new Pipeline that operates on a specified Firestore collection.

        Args:
            path: The path to the Firestore collection (e.g., "users"). Can either be:
                * A single ``/``-delimited path to a collection
                * A tuple of collection path segment
        Returns:
            a new pipeline instance targeting the specified collection
        )
isinstancetupler   joinr   stages
Collection)r   r"   r   r   r   
collectionG   s   

zPipelineSource.collectioncollection_idstrc                 C  s   |  t|S )a	  
        Creates a new Pipeline that that operates on all documents in a collection group.
        Args:
            collection_id: The ID of the collection group
        Returns:
            a new pipeline instance targeting the specified collection group
        )r   r'   CollectionGroup)r   r*   r   r   r   collection_groupV   s   zPipelineSource.collection_groupc                 C  s   |  t S )z
        Creates a new Pipeline that operates on all documents in the Firestore database.
        Returns:
            a new pipeline instance targeting the specified collection
        )r   r'   Database)r   r   r   r   database`   s   zPipelineSource.databasedocs'BaseDocumentReference'c                 G  s   |  tjj| S )a.  
        Creates a new Pipeline that operates on a specific set of Firestore documents.
        Args:
            docs: The DocumentReference instances representing the documents to include in the pipeline.
        Returns:
            a new pipeline instance targeting the specified documents
        )r   r'   	Documentsof)r   r0   r   r   r   	documentsh   s   zPipelineSource.documentsN)r   r   )r   r   r   r   )r"   r#   r   r   )r*   r+   r   r   )r   r   )r0   r1   r   r   )__name__
__module____qualname____doc__r   r   r!   r)   r-   r/   r4   r   r   r   r   r   &   s    
	




r   N)r8   
__future__r   typingr   r   r   google.cloud.firestore_v1r   r'   'google.cloud.firestore_v1.base_pipeliner   "google.cloud.firestore_v1._helpersr    google.cloud.firestore_v1.clientr	   &google.cloud.firestore_v1.async_clientr
   'google.cloud.firestore_v1.base_documentr   $google.cloud.firestore_v1.base_queryr   *google.cloud.firestore_v1.base_aggregationr   )google.cloud.firestore_v1.base_collectionr   r   r   r   r   r   r   <module>   s   