o
    Ej                     @  sT   d dl mZ d dlZd dlmZ d dlmZ d dlmZ G dd dZ	dd
dZ
dS )    )annotationsN)deepcopy)Path)Anyc                   @  s4   e Zd ZdddZddd	ZdddZdddZdS )LocalJsonStorepath
str | PathreturnNonec                 C  s:   t || _| jjjddd | j s| t  d S d S )NT)parentsexist_ok)r   r   parentmkdirexistswrite_empty_state)selfr    r   8/opt/sixxie/releases/current/services/api/local_store.py__init__
   s
   

zLocalJsonStore.__init__dict[str, Any]c              
   C  s<   zt | jjddW S  t jy } ztd|d }~ww )Nutf-8encodingz!local API store is not valid JSON)jsonloadsr   	read_textJSONDecodeError
ValueError)r   excr   r   r   read   s   
zLocalJsonStore.readstatec                 C  s$   | j jtj|dddd dd d S )NF   )ensure_asciiindent
r   r   )r   
write_textr   dumps)r   r!   r   r   r   r      s   $zLocalJsonStore.writec                 C  s   t |  S )N)r   r    )r   r   r   r   transaction   s   zLocalJsonStore.transactionN)r   r   r	   r
   r	   r   )r!   r   r	   r
   )__name__
__module____qualname__r   r    r   r(   r   r   r   r   r   	   s
    


r   r	   r   c                   C  s   i di di di di di di di di d	i d
i dg di di di di dg di g g g dddddddddddddddS )Nusersapi_sessionsbeta_invitesinvite_redemptionsprice_planssubscriptionspet_profiles	pet_media
pet_buildspet_packagesprovider_call_metricsorderswebhook_eventsentitlementsquota_bucketsusage_ledgerdeletion_requestsr   )petmediabuildpackageorderentitlementsubscriptioninvitequotausageauditwebhookevent)
audit_logsbuild_queueeventscountersr   r   r   r   r   r      sj   	
r   r)   )
__future__r   r   copyr   pathlibr   typingr   r   r   r   r   r   r   <module>   s    