Ë
    tPêjÖ  ã                   ó`   — d dl mZ d dlmZ d dlmZ d dlZd dlmZm	Z	m
Z
 d dlmZ de	de
fd	„Zy)
é    )Ú	timedelta)ÚFinal)ÚHTTPExceptionN)ÚCommonProxyErrorsÚInvitationNewÚUserAPIKeyAuth)ÚInvitationLinkRepositoryÚdataÚuser_api_key_dictc           	   ƒ   ó  K  — ddl m}m} |€'t        ddt        j
                  j                  i¬«      ‚t        j                  j                  «       }|t        d¬«      z   }	 t        |«      j                  j                  | j                  |||j                  xs |||j                  xs |d	œ¬
«      ƒ d{  –—† }|S 7 Œ# t        $ r9}dt!        |«      v rt        dddi¬«      ‚t        ddt!        |«      i¬«      ‚d}~ww xY w­w)zK
    Create an invitation for the user to onboard to LiteLLM Admin UI.
    r   )Úlitellm_proxy_admin_nameÚprisma_clientNi�  Úerror)Ústatus_codeÚdetailé   )Údays)Úuser_idÚ
created_atÚ
expires_atÚ
created_byÚ
updated_atÚ
updated_by)r
   z*Foreign key constraint failed on the fieldzYUser id does not exist in 'LiteLLM_UserTable'. Fix this by creating user via `/user/new`.iô  )Úlitellm.proxy.proxy_serverr   r   r   r   Údb_not_connected_errorÚvalueÚlitellmÚutilsÚget_utc_datetimer   r	   ÚtableÚcreater   Ú	ExceptionÚstr)r
   r   r   r   Úcurrent_timer   ÚresponseÚes           úu/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/litellm/proxy/management_helpers/user_invitation.pyÚcreate_invitation_for_userr(      s  è ø€ ÷ SàÐÜØØÔ.×EÑE×KÑKÐLô
ð 	
ô
 "Ÿ-™-×8Ñ8Ó:€LØ$¤y°aÔ'8Ñ8€JðGÜ 8¸Ó G× MÑ M× TÑ TàŸ<™<Ø*Ø(Ø/×7Ñ7ÒSÐ;SØ*Ø/×7Ñ7ÒSÐ;Sñð !Uó 	!
÷ 	
ˆð ˆð	
ùô ò GØ7¼3¸q»6ÑAÜØàÐxðôð ô ¨°W¼cÀ!»fÐ4EÔFÐFûðGüs=   ‚ADÁ"AC  Â7B>Â8C  Â=DÂ>C  Ã 	DÃ	4C=Ã=DÄD)Údatetimer   Útypingr   Úfastapir   r   Úlitellm.proxy._typesr   r   r   Ú'litellm.repositories.table_repositoriesr	   r(   © ó    r'   ú<module>r0      s2   ðÝ Ý å !ã ß QÑ QÝ Lð&GØ
ð&Gà%ô&Gr/   