// Copyright © 2020 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace CefSharp.DevTools
{
///
/// DevTools Client
///
public interface IDevToolsClient
{
///
/// Will be called on receipt of a DevTools protocol event. Events by default are disabled and need to be
/// enabled on a per domain basis, e.g. Sending Network.enable (or calling )
/// to enable network related events.
///
event EventHandler DevToolsEvent;
///
/// Registers an event handler for a DevTools protocol event. Events by default are disabled and need to be
/// enabled on a per domain basis, e.g. Sending Network.enable (or calling )
/// to enable network related events.
///
/// The event args type to which the event will be deserialized to.
/// is the event name to listen to
/// event handler to call when the event occurs
/// return an IRegistration that can be used to unregister the event handler.
IRegistration RegisterEventHandler(string eventName, EventHandler eventHandler) where T : DevToolsDomainEventArgsBase;
///
/// Execute a method call over the DevTools protocol. This method can be called on any thread.
/// See the DevTools protocol documentation at https://chromedevtools.github.io/devtools-protocol/ for details
/// of supported methods and the expected dictionary contents.
///
/// The type into which the result will be deserialzed.
/// is the method name
/// are the method parameters represented as a dictionary,
/// which may be empty.
/// return a Task that can be awaited to obtain the method result
Task ExecuteDevToolsMethodAsync(string method, IDictionary parameters = null) where T : DevToolsDomainResponseBase;
}
}