
    f                     f    d dl mZ d dlmZ d dlmZ d dlmZ  G d de      Z G d de      Z	e	gZ
y	)
    EmailAddress)ProviderAccount)NotionOAuth2Adapter)OAuth2Providerc                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)NotionAccountc                 :    | j                   j                  d   d   S )Nowneruseraccount
extra_dataselfs    j/var/www/cs2snipe.com/venv/lib/python3.12/site-packages/allauth/socialaccount/providers/notion/provider.pyget_userzNotionAccount.get_user   s    ||&&w/77    c                 (    | j                         d   S )Nnamer   r   s    r   get_namezNotionAccount.get_name   s    }}v&&r   c                 (    | j                         d   S )N
avatar_urlr   r   s    r   get_avatar_urlzNotionAccount.get_avatar_url   s    }}|,,r   c                 4    | j                   j                  d   S )Nworkspace_namer   r   s    r   get_workspace_namez NotionAccount.get_workspace_name       ||&&'788r   c                 4    | j                   j                  d   S )Nworkspace_iconr   r   s    r   get_workspace_iconz NotionAccount.get_workspace_icon   r   r   c                 R    | j                         }| j                         }| d| dS )Nz ())r   r   )r   r   	workspaces      r   to_strzNotionAccount.to_str   s.    }}++-	r)A&&r   N)	__name__
__module____qualname__r   r   r   r   r"   r&    r   r   r	   r	      s     8'-99'r   r	   c                   .    e Zd ZdZdZeZeZd Z	d Z
d Zy)NotionProvidernotionNotionc                 2    |d   d   d   }|d   }d|d|S )z
        The unique identifier for Notion is a combination of the User ID
        and the Workspace ID they have authorized the application with.
        r   r   idworkspace_idzuser-z_workspace-r*   )r   datauser_idr1   s       r   extract_uidzNotionProvider.extract_uid#   s,    
 w-'-N+)0,??r   c                 ,    |d   d   }|d   d   |d<   |S )Nr   r   personemailr*   )r   r2   r   s      r   extract_common_fieldsz$NotionProvider.extract_common_fields,   s'    G}V$Xw/Wr   c                 @    |d   d   }|d   d   }t        |dd      gS )Nr   r   r6   r7   T)r7   verifiedprimaryr   )r   r2   r   r7   s       r   extract_email_addressesz&NotionProvider.extract_email_addresses1   s0    G}V$Xw'54FGGr   N)r'   r(   r)   r0   r   r	   account_classr   oauth2_adapter_classr4   r8   r<   r*   r   r   r,   r,      s(    	BD!M.@
Hr   r,   N)allauth.account.modelsr   $allauth.socialaccount.providers.baser   ,allauth.socialaccount.providers.notion.viewsr   /allauth.socialaccount.providers.oauth2.providerr   r	   r,   provider_classesr*   r   r   <module>rD      s6    / @ L J'O ',H^ H4 ## r   