Ë
    ö%9j  ã                  óV  — 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  e«       j                  «       Ze
j                   j#                  «       D ]&  \  ZZej)                  d«      rŒeevsŒe e«       e<   Œ( 	 dZddd„Z G d„ d«      Zy
# e$ rZ ed	«      e‚d
Z[ww xY w)zÆCloud Firestore module.

This module contains utilities for accessing the Google Cloud Firestore databases associated with
Firebase apps. This requires the ``google-cloud-firestore`` Python module.
é    )Úannotations)ÚOptionalÚDict)ÚApp)Ú_utils)Ú	firestore)ÚDEFAULT_DATABASEÚ_zrFailed to import the Cloud Firestore library for Python. Make sure to install the "google-cloud-firestore" module.NÚ
_firestorec                ó¤   — |�t        |t        «      st        d|› d�«      ‚t        j                  | t
        t        «      }|j                  |«      S )a,  Returns a client that can be used to interact with Google Cloud Firestore.

    Args:
        app: An App instance (optional).
        database_id: The database ID of the Google Cloud Firestore database to be used.
            Defaults to the default Firestore database ID if not specified or an empty string
            (optional).

    Returns:
        google.cloud.firestore.Firestore: A `Firestore Client`_.

    Raises:
        ValueError: If the specified database ID is not a valid string, or if a project ID is not
            specified either via options, credentials or environment variables, or if the specified
            project ID is not a valid string.

    .. _Firestore Client: https://cloud.google.com/python/docs/reference/firestore/latest/        google.cloud.firestore_v1.client.Client
    zdatabase_id "z" must be a string or None.)Ú
isinstanceÚstrÚ
ValueErrorr   Úget_app_serviceÚ_FIRESTORE_ATTRIBUTEÚ_FirestoreServiceÚ
get_client)ÚappÚdatabase_idÚ
fs_services      úT/var/www/html/truck-me/venv/lib/python3.12/site-packages/firebase_admin/firestore.pyÚclientr   )   sO   € ð* Ð¤z°+¼sÔ'CÜ˜=¨¨Ð5PÐQÓRÐRÜ×'Ñ'¨Ô-AÔCTÓU€JØ× Ñ  Ó-Ð-ó    c                  ó    — e Zd ZdZdd„Zdd„Zy)r   z9Service that maintains a collection of firestore clients.c                ó    — || _         i | _        y )N)Ú_appÚ_clients)Úselfr   s     r   Ú__init__z_FirestoreService.__init__G   s   € ØˆŒ	Ø57ˆ�r   c                ó,  — |xs t         }|| j                  vrn| j                  j                  j	                  «       }| j                  j
                  }|st        d«      ‚t        j                  |||¬«      }|| j                  |<   | j                  |   S )zDCreates a client based on the database_id. These clients are cached.z²Project ID is required to access Firestore. Either set the projectId option, or use service account credentials. Alternatively, set the GOOGLE_CLOUD_PROJECT environment variable.)ÚcredentialsÚprojectÚdatabase)	r	   r   r   Ú
credentialÚget_credentialÚ
project_idr   r   ÚClient)r   r   r!   r"   Ú	fs_clients        r   r   z_FirestoreService.get_clientK   s�   € à!Ò5Ô%5ˆØ˜dŸm™mÑ+àŸ)™)×.Ñ.×=Ñ=Ó?ˆKØ—i‘i×*Ñ*ˆGÙÜ ðAóBð Bô
 "×(Ñ(Ø'°À;ôPˆIà)2ˆD�M‰M˜+Ñ&à�}‰}˜[Ñ)Ð)r   N)r   r   ÚreturnÚNone)r   úOptional[str]r)   úfirestore.Client)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   © r   r   r   r   D   s   „ ÙCó8ô*r   r   )NN)r   zOptional[App]r   r+   r)   r,   )r0   Ú
__future__r   Útypingr   r   Úfirebase_adminr   r   Úgoogle.cloudr   Ú%google.cloud.firestore_v1.base_clientr	   ÚglobalsÚkeysÚexistingÚ__dict__ÚitemsÚkeyÚvalueÚ
startswithÚImportErrorÚerrorr   r   r   r1   r   r   ú<module>rA      s¶   ðñõ #ß !Ý Ý !ð	TÝ&ÝFÙ‹y�~‰~Ó€HØ×(Ñ(×.Ñ.Ó0ò #‰
ˆˆUØ�~‰~˜cÕ" s°(Ò':Ø"‰G‹I�cŠNñ#ð $Ð ô.÷6*ò *øðG ò TÙ
ð Hó IØNSðTûðTús$   žAB Á1B Á6B ÂB(Â	B#Â#B(