U
    g                     @  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eG dd dZ	d dd	d
ddZ
d	dddZdd	dddZdd	dddZdd	dddZdd	dddZedeG dd dZedeG dd dZdS )!    )annotations   )event_classT_JSON_DICT)	dataclassNc                   @  s>   e Zd ZU ded< ded< dZded< dd Zed	d
 ZdS )Sinkstrnameid_Ntyping.Optional[str]sessionc                 C  s2   t  }| j|d< | j|d< | jd k	r.| j|d< |S )Nr	   idr   )dictr	   r
   r   )selfjson r   P/tmp/pip-unpacked-wheel-3ysq0mf8/selenium/webdriver/common/devtools/v129/cast.pyto_json   s    



zSink.to_jsonc                 C  s2   | t |d t |d d|kr*t |d nd dS )Nr	   r   r   )r	   r
   r   r   clsr   r   r   r   	from_json   s
    

zSink.from_json)__name__
__module____qualname____annotations__r   r   classmethodr   r   r   r   r   r      s   
r   r   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, None])presentation_urlreturnc                 c  s*   t  }| dk	r| |d< d|d}|V }dS )al  
    Starts observing for sinks that can be used for tab mirroring, and if set,
    sinks compatible with ``presentationUrl`` as well. When sinks are found, a
    ``sinksUpdated`` event is fired.
    Also starts observing for issue messages. When an issue is added or removed,
    an ``issueUpdated`` event is fired.

    :param presentation_url: *(Optional)*
    NZpresentationUrlzCast.enablemethodparamsr   )r   r!   cmd_dictr   r   r   r   enable(   s    r$   )r   c                  c  s   ddi} | V }dS )z/
    Stops observing for sinks and issues.
    r    zCast.disableNr   )r#   r   r   r   r   disable>   s     r%   r   )	sink_namer   c                 c  s"   t  }| |d< d|d}|V }dS )z
    Sets a sink to be used when the web page requests the browser to choose a
    sink via Presentation API, Remote Playback API, or Cast SDK.

    :param sink_name:
    sinkNamezCast.setSinkToUser   Nr"   r&   r!   r#   r   r   r   r   set_sink_to_useH   s    	r)   c                 c  s"   t  }| |d< d|d}|V }dS )zJ
    Starts mirroring the desktop to the sink.

    :param sink_name:
    r'   zCast.startDesktopMirroringr   Nr"   r(   r   r   r   start_desktop_mirroringZ   s    r*   c                 c  s"   t  }| |d< d|d}|V }dS )zF
    Starts mirroring the tab to the sink.

    :param sink_name:
    r'   zCast.startTabMirroringr   Nr"   r(   r   r   r   start_tab_mirroringk   s    r+   c                 c  s"   t  }| |d< d|d}|V }dS )zK
    Stops the active Cast session on the sink.

    :param sink_name:
    r'   zCast.stopCastingr   Nr"   r(   r   r   r   stop_casting|   s    r,   zCast.sinksUpdatedc                   @  s.   e Zd ZU dZded< edd dddZdS )	SinksUpdatedz
    This is fired whenever the list of available sinks changes. A sink is a
    device or a software surface that you can cast to.
    ztyping.List[Sink]sinksr   r   r   c                 C  s   | dd |d D dS )Nc                 S  s   g | ]}t |qS r   )r   r   ).0ir   r   r   
<listcomp>   s     z*SinksUpdated.from_json.<locals>.<listcomp>r.   )r.   r   r   r   r   r   r      s    zSinksUpdated.from_jsonNr   r   r   __doc__r   r   r   r   r   r   r   r-      s   
r-   zCast.issueUpdatedc                   @  s.   e Zd ZU dZded< edd dddZdS )	IssueUpdatedz
    This is fired whenever the outstanding issue/error message changes.
    ``issueMessage`` is empty if there is no issue.
    r   issue_messager   r/   c                 C  s   | t |d dS )NZissueMessage)r6   r   r   r   r   r   r      s    
zIssueUpdated.from_jsonNr3   r   r   r   r   r5      s   
r5   )N)
__future__r   utilr   r   Zdataclassesr   enumtypingr   r$   r%   r)   r*   r+   r,   r-   r5   r   r   r   r   <module>   s&    
