U
    ä«Fcô	  ã                   @   s   G d d„ de ƒZdS )c                   @   sp   e Zd ZdZddd„Zedd„ ƒZejdd„ ƒZedd	„ ƒZejd
d	„ ƒZedd„ ƒZ	e	jdd„ ƒZ	dd„ Z
dS )ÚSubstitutionz˜A string substitution to be applied to the text and HTML contents of
    the body of your email, as well as in the Subject and Reply-To parameters.
    Nc                 C   s@   d| _ d| _d| _|dk	r || _|dk	r.|| _|dk	r<|| _dS )a˜  Create a Substitution with the given key and value.

        :param key: Text to be replaced with "value" param
        :type key: string, optional
        :param value: Value to substitute into email
        :type value: string, optional
        :param name: p is the Personalization object or Personalization object
                     index
        :type name: Personalization, integer, optional
        N)Ú_keyÚ_valueÚ_personalizationÚkeyÚvalueÚpersonalization)Úselfr   r   Úp© r
   úF/tmp/pip-unpacked-wheel-7j3043uk/sendgrid/helpers/mail/substitution.pyÚ__init__   s    zSubstitution.__init__c                 C   s   | j S )z:The substitution key.

        :rtype key: string
        ©r   ©r   r
   r
   r   r      s    zSubstitution.keyc                 C   s
   || _ dS )zcThe substitution key.

        :param key: The substitution key.
        :type key: string
        Nr   ©r   r   r
   r
   r   r   $   s    c                 C   s   t | jtƒrt| jƒS | jS )z>The substitution value.

        :rtype value: string
        )Ú
isinstancer   ÚintÚstrr   r
   r
   r   r   -   s    zSubstitution.valuec                 C   s
   || _ dS )zkThe substitution value.

        :param value: The substitution value.
        :type value: string
        N)r   r   r
   r
   r   r   5   s    c                 C   s   | j S )zmThe Personalization object or Personalization object index

        :rtype: Personalization, integer
        ©r   r   r
   r
   r   r   >   s    zSubstitution.personalizationc                 C   s
   || _ dS )zÙThe Personalization object or Personalization object index

        :param value: The Personalization object or Personalization object
                      index
        :type value: Personalization, integer
        Nr   r   r
   r
   r   r   F   s    c                 C   s(   i }| j dk	r$| jdk	r$| j|| j < |S )z£
        Get a JSON-ready representation of this Substitution.

        :returns: This Substitution, ready for use in a request body.
        :rtype: dict
        N)r   r   )r   Zsubstitutionr
   r
   r   ÚgetP   s    zSubstitution.get)NNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr   Úsetterr   r   r   r
   r
   r
   r   r      s   






	r   N)Úobjectr   r
   r
   r
   r   Ú<module>   ó    