o
    ҷh                     @  s   d dl mZ ddlmZmZ d dlmZ d dlZd dlZG dd de	Z
G dd	 d	e	ZeG d
d dZdddZdddZdddZdddZedeG dd dZdS )    )annotations   )event_classT_JSON_DICT)	dataclassNc                      8   e Zd ZdZdddZedddZ fd	d
Z  ZS )	RequestIdz
    Device request id.
    returnstrc                 C     | S N selfr   r   h/var/www/html/venv/lib/python3.10/site-packages/selenium/webdriver/common/devtools/v118/device_access.pyto_json      zRequestId.to_jsonjsonc                 C     | |S r   r   clsr   r   r   r   	from_json      zRequestId.from_jsonc                      d t  S )NzRequestId({})formatsuper__repr__r   	__class__r   r   r         zRequestId.__repr__r	   r
   )r   r
   r	   r   	__name__
__module____qualname____doc__r   classmethodr   r   __classcell__r   r   r   r   r          
r   c                      r   )DeviceIdz
    A device id.
    r	   r
   c                 C  r   r   r   r   r   r   r   r       r   zDeviceId.to_jsonr   c                 C  r   r   r   r   r   r   r   r   #   r   zDeviceId.from_jsonc                   r   )NzDeviceId({})r   r   r   r   r   r   '   r    zDeviceId.__repr__r!   )r   r
   r	   r*   r"   r   r   r   r   r*      r)   r*   c                   @  s6   e Zd ZU dZded< ded< dd Zedd	 Zd
S )PromptDevicezK
    Device information displayed in a user prompt to select a device.
    r*   id_r
   namec                 C  s"   t  }| j |d< | j|d< |S )Nidr-   )dictr,   r   r-   )r   r   r   r   r   r   5   s   
zPromptDevice.to_jsonc                 C  s   | t |d t|d dS )Nr.   r-   )r,   r-   )r*   r   r
   r   r   r   r   r   ;   s   
zPromptDevice.from_jsonN)r#   r$   r%   r&   __annotations__r   r'   r   r   r   r   r   r+   +   s   
 r+   r	   0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c                  c      ddi} | V }dS )z'
    Enable events in this domain.
    methodzDeviceAccess.enableNr   cmd_dictr   r   r   r   enableC      
r6   c                  c  r2   )z(
    Disable events in this domain.
    r3   zDeviceAccess.disableNr   r4   r   r   r   disableM   r7   r8   r,   	device_idc                 c  s4    t  }|  |d< | |d< d|d}|V }dS )z{
    Select a device in response to a DeviceAccess.deviceRequestPrompted event.

    :param id_:
    :param device_id:
    r.   deviceIdzDeviceAccess.selectPromptr3   paramsNr/   r   )r,   r9   r<   r5   r   r   r   r   select_promptW   s   

r>   c                 c  s(    t  }|  |d< d|d}|V }dS )ze
    Cancel a prompt in response to a DeviceAccess.deviceRequestPrompted event.

    :param id_:
    r.   zDeviceAccess.cancelPromptr;   Nr=   )r,   r<   r5   r   r   r   r   cancel_promptk   s   
r?   z"DeviceAccess.deviceRequestPromptedc                   @  s0   e Zd ZU dZded< ded< edd	d
ZdS )DeviceRequestPromptedz~
    A device request opened a user prompt to select a device. Respond with the
    selectPrompt or cancelPrompt command.
    r   r,   ztyping.List[PromptDevice]devicesr   r   r	   c                 C  s$   | t |d dd |d D dS )Nr.   c                 S  s   g | ]}t |qS r   )r+   r   ).0ir   r   r   
<listcomp>   s    z3DeviceRequestPrompted.from_json.<locals>.<listcomp>rA   )r,   rA   )r   r   r   r   r   r   r      s   zDeviceRequestPrompted.from_jsonN)r   r   r	   r@   )r#   r$   r%   r&   r0   r'   r   r   r   r   r   r@   |   s   
 r@   )r	   r1   )r,   r   r9   r*   r	   r1   )r,   r   r	   r1   )
__future__r   utilr   r   dataclassesr   enumtypingr
   r   r*   r+   r6   r8   r>   r?   r@   r   r   r   r   <module>   s    





