U
    Ð~fh®  ã                   @   s6   d dl mZ d dl mZ ddlmZ G dd„ dƒZdS )é    )ÚList)ÚOptionalé   ©ÚAccountc                   @   s¢   e Zd ZdZdZdZddœdd„Zeee	 dœdd	„ƒZ
ee	dœd
d„ƒZeee	 dœdd„ƒZee dœdd„Zeddœdd„Zddœdd„Zddœdd„ZdS )ÚDialogz6Represents a FedCM dialog that can be interacted with.ZAccountChooserZAutoReauthnN)Úreturnc                 C   s
   || _ d S )N)Ú_driver)ÚselfZdriver© r   úJ/tmp/pip-unpacked-wheel-_w7xr53_/selenium/webdriver/common/fedcm/dialog.pyÚ__init__   s    zDialog.__init__c                 C   s
   | j jjS )z2Gets the type of the dialog currently being shown.)r	   ÚfedcmZdialog_type©r
   r   r   r   Útype!   s    zDialog.typec                 C   s
   | j jjS )zGets the title of the dialog.)r	   r   Útitler   r   r   r   r   &   s    zDialog.titlec                 C   s   | j jj}|r| d¡S dS )z Gets the subtitle of the dialog.ÚsubtitleN)r	   r   r   Úget)r
   Úresultr   r   r   r   +   s    
zDialog.subtitlec                 C   s   | j jj}dd„ |D ƒS )z.Gets the list of accounts shown in the dialog.c                 S   s   g | ]}t |ƒ‘qS r   r   )Ú.0Úaccountr   r   r   Ú
<listcomp>4   s     z'Dialog.get_accounts.<locals>.<listcomp>)r	   r   Zaccount_list)r
   Zaccountsr   r   r   Úget_accounts1   s    
zDialog.get_accounts)Úindexr   c                 C   s   | j j |¡ dS )z,Selects an account from the dialog by index.N)r	   r   Úselect_account)r
   r   r   r   r   r   6   s    zDialog.select_accountc                 C   s   | j j ¡  dS )z)Clicks the continue button in the dialog.N)r	   r   Úacceptr   r   r   r   r   :   s    zDialog.acceptc                 C   s   | j j ¡  dS )zCancels/dismisses the dialog.N)r	   r   Údismissr   r   r   r   r   >   s    zDialog.dismiss)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ZDIALOG_TYPE_ACCOUNT_LISTZDIALOG_TYPE_AUTO_REAUTHr   Úpropertyr   Ústrr   r   r   r   r   r   Úintr   r   r   r   r   r   r   r      s   r   N)Útypingr   r   r   r   r   r   r   r   r   Ú<module>   s   