a
    AWeS                     @   s4   d dl mZmZmZ d dlmZ G dd deZdS )    )StringFieldReferenceFieldDateTimeField)Basec                   @   s^   e Zd ZdZeddZeddZedddZeddd	Z	ed
dZ
eddZedddZdS )	Blacklista  
    Model for blacklisting tokens or entities.

    Attributes:
        token (str): The token or entity to be blacklisted (required).
        token_type (str): The type of token (e.g., 'access' or 'refresh').
        user (User): The user associated with the token.
        jti (str): The unique JWT ID (if applicable).
        reason (str): The reason for blacklisting (e.g., 'expired' or 'revoked').
        blacklisted_at (datetime): The date and time when the token was blacklisted.

    Methods:
        __str__(): Return the token as a string representation.
        is_token_valid(): Check if the token is still valid and not blacklisted.
        blacklist(reason: str): Blacklist the token with a given reason.
    z&The token or entity to be blacklisted.)	help_textz0The type of token (e.g., 'access' or 'refresh').Userz#The user associated with the token.Tz"The unique JWT ID (if applicable).)requiredr   zThe reason for blacklisting.z1The date and time when the token was blacklisted.)returnc                 C   s   | j S )z
        Return the token as a string representation.

        Returns:
            str: The token or entity being blacklisted.
        )token)self r   /app/app/models/blacklist.py__str__   s    zBlacklist.__str__N)__name__
__module____qualname____doc__r   r   
token_typer   userjtireasonr   
revoked_atstrr   r   r   r   r   r      s   



r   N)mongoenginer   r   r   
app.modelsr   r   r   r   r   r   <module>   s   