a
    !f&                     @   s   d dl mZ d dlZd dlZdd ZG dd deZG dd deZG d	d
 d
eZG dd deZG dd deZ	G dd deZ
dS )    )AccessTokenGrantNc                    s   t   fdd}|S )zThis is a decorator which can be used to mark functions
    as deprecated. It will result in a warning being emitted
    when the function is used.c                     s>   t dt t jd jtdd t dt  | i |S )NalwayszCall to deprecated function {}.   )category
stackleveldefault)warningssimplefilterDeprecationWarningwarnformat__name__)argskwargsfunc _/var/www/html/python-backend/venv/lib/python3.9/site-packages/twilio/jwt/access_token/grants.pynew_func   s    
zdeprecated.<locals>.new_func)	functoolswraps)r   r   r   r   r   
deprecated   s    
r   c                   @   s.   e Zd ZdZd	ddZedd Zdd ZdS )
	ChatGrantzGrant to access Twilio ChatNc                 C   s   || _ || _|| _|| _d S Nservice_sidendpoint_iddeployment_role_sidpush_credential_sid)selfr   r   r   r   r   r   r   __init__   s    zChatGrant.__init__c                 C   s   dS )NZchatr   r   r   r   r   key(   s    zChatGrant.keyc                 C   sH   i }| j r| j |d< | jr$| j|d< | jr4| j|d< | jrD| j|d< |S )Nr   r   r   r   r   r   grantr   r   r   
to_payload,   s    



zChatGrant.to_payload)NNNNr   
__module____qualname____doc__r    propertyr"   r%   r   r   r   r   r      s       

r   c                   @   s.   e Zd ZdZd	ddZedd Zdd ZdS )
	SyncGrantzGrant to access Twilio SyncNc                 C   s   || _ || _d S r   r   r   )r   r   r   r   r   r   r    =   s    zSyncGrant.__init__c                 C   s   dS )NZ	data_syncr   r!   r   r   r   r"   A   s    zSyncGrant.keyc                 C   s(   i }| j r| j |d< | jr$| j|d< |S )Nr   r   r,   r#   r   r   r   r%   E   s    

zSyncGrant.to_payload)NNr&   r   r   r   r   r+   :   s
   

r+   c                   @   s.   e Zd ZdZd	ddZedd Zdd ZdS )

VoiceGrantz)Grant to access Twilio Programmable VoiceNc                 C   s"   || _ || _|| _|| _|| _d S r   incoming_allowoutgoing_application_sidoutgoing_application_paramsr   r   )r   r/   r0   r1   r   r   r   r   r   r    R   s    zVoiceGrant.__init__c                 C   s   dS )NZvoicer   r!   r   r   r   r"   e   s    zVoiceGrant.keyc                 C   sv   i }| j du r"i |d< d|d d< | jrRi |d< | j|d d< | jrR| j|d d< | jrb| j|d< | jrr| j|d< |S )	NTincomingZallowoutgoingZapplication_sidparamsr   r   r.   r#   r   r   r   r%   i   s    


zVoiceGrant.to_payload)NNNNNr&   r   r   r   r   r-   O   s        

r-   c                   @   s.   e Zd ZdZd	ddZedd Zdd ZdS )

VideoGrantzGrant to access Twilio VideoNc                 C   s
   || _ d S r   room)r   r7   r   r   r   r       s    zVideoGrant.__init__c                 C   s   dS )NZvideor   r!   r   r   r   r"      s    zVideoGrant.keyc                 C   s   i }| j r| j |d< |S )Nr7   r6   r#   r   r   r   r%      s    
zVideoGrant.to_payload)Nr&   r   r   r   r   r5      s
   

r5   c                   @   s.   e Zd ZdZd	ddZedd Zdd ZdS )
TaskRouterGrantz!Grant to access Twilio TaskRouterNc                 C   s   || _ || _|| _d S r   workspace_sid
worker_sidrole)r   r:   r;   r<   r   r   r   r       s    zTaskRouterGrant.__init__c                 C   s   dS )NZtask_routerr   r!   r   r   r   r"      s    zTaskRouterGrant.keyc                 C   s8   i }| j r| j |d< | jr$| j|d< | jr4| j|d< |S )Nr:   r;   r<   r9   r#   r   r   r   r%      s    


zTaskRouterGrant.to_payload)NNNr&   r   r   r   r   r8      s
   

r8   c                   @   s.   e Zd ZdZd	ddZedd Zdd ZdS )
PlaybackGrantz"Grant to access Twilio Live streamNc                 C   s
   || _ dS )zFInitialize a PlaybackGrant with a grant retrieved from the Twilio API.Nr$   r#   r   r   r   r       s    zPlaybackGrant.__init__c                 C   s   dS )zReturn the grant's key.Zplayerr   r!   r   r   r   r"      s    zPlaybackGrant.keyc                 C   s   | j S )zReturn the grant.r>   r!   r   r   r   r%      s    zPlaybackGrant.to_payload)Nr&   r   r   r   r   r=      s
   

r=   )Ztwilio.jwt.access_tokenr   r   r   r   r   r+   r-   r5   r8   r=   r   r   r   r   <module>   s   !0