/**
 * Copyright (c) Microsoft Corporation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { eventsHelper } from '@utils/eventsHelper';
import { DebugController } from '../debugController';
import { Dispatcher } from './dispatcher';
export class DebugControllerDispatcher extends Dispatcher {
    _type_DebugController;
    _listeners;
    constructor(connection, debugController) {
        super(connection, debugController, 'DebugController', {});
        this._type_DebugController = true;
        this._listeners = [
            eventsHelper.addEventListener(this._object, DebugController.Events.StateChanged, params => {
                this._dispatchEvent('stateChanged', params);
            }),
            eventsHelper.addEventListener(this._object, DebugController.Events.InspectRequested, ({ selector, locator, ariaSnapshot }) => {
                this._dispatchEvent('inspectRequested', { selector, locator, ariaSnapshot });
            }),
            eventsHelper.addEventListener(this._object, DebugController.Events.SourceChanged, ({ text, header, footer, actions }) => {
                this._dispatchEvent('sourceChanged', ({ text, header, footer, actions }));
            }),
            eventsHelper.addEventListener(this._object, DebugController.Events.Paused, ({ paused }) => {
                this._dispatchEvent('paused', ({ paused }));
            }),
            eventsHelper.addEventListener(this._object, DebugController.Events.SetModeRequested, ({ mode }) => {
                this._dispatchEvent('setModeRequested', ({ mode }));
            }),
        ];
    }
    async initialize(params, progress) {
        this._object.initialize(progress, params.codegenId, params.sdkLanguage);
    }
    async setReportStateChanged(params, progress) {
        this._object.setReportStateChanged(progress, params.enabled);
    }
    async setRecorderMode(params, progress) {
        await this._object.setRecorderMode(progress, params);
    }
    async highlight(params, progress) {
        await this._object.highlight(progress, params);
    }
    async hideHighlight(params, progress) {
        await this._object.hideHighlight(progress);
    }
    async resume(params, progress) {
        await this._object.resume(progress);
    }
    async kill(params, progress) {
        this._object.kill(progress);
    }
    _onDispose() {
        eventsHelper.removeEventListeners(this._listeners);
        this._object.dispose();
    }
}
//# sourceMappingURL=debugControllerDispatcher.js.map