import { EventTypes } from './EventTypes.js';
export class AppNavigationEvent extends CustomEvent {
    constructor(type, detail = {}) {
        super(type, {
            bubbles: true,
            cancelable: true,
            composed: true,
            detail,
        });
    }
}
export default Object.freeze({
    /**
     * Inter-app navigation events.
     * They allow to open one app from another.
     * The controller is the `NavigationBindings` class.
     */
    App: Object.freeze({
        /**
         * Opens the HTTP Project application. The detail object
         * requires providing at least the `key` of the project to run.
         * The `NavigationBindings` should focus on the already created
         * window or create a new one when previous window does not exist.
         *
         * @param detail The init environment for the HTTP Project app.
         * @param target Optional events target
         */
        runHttpProject: (detail, target = document.body) => {
            const e = new AppNavigationEvent(EventTypes.Navigation.App.runHttpProject, detail);
            target.dispatchEvent(e);
        },
        /**
         * Opens the HTTP Client application.
         *
         * @param detail The init environment for the HTTP Client app.
         * @param target Optional events target
         */
        runHttpClient: (detail, target = document.body) => {
            const e = new AppNavigationEvent(EventTypes.Navigation.App.runApiClient, detail);
            target.dispatchEvent(e);
        },
        /**
         * Opens the Schema Designer application. The detail object requires
         * providing at least the `key` of the schema to run.
         *
         * @param detail The init environment for the Schema Designer app.
         * @param target Optional events target
         */
        runSchemaDesigner: (detail, target = document.body) => {
            const e = new AppNavigationEvent(EventTypes.Navigation.App.runSchemaDesigner, detail);
            target.dispatchEvent(e);
        },
        /**
         * Opens the main start window.
         *
         * @param target Optional events target
         */
        runTelemetry: (detail, target = document.body) => {
            const e = new AppNavigationEvent(EventTypes.Navigation.App.runTelemetry, detail || {});
            target.dispatchEvent(e);
        },
    }),
    Store: Object.freeze({
        /**
         * Opens the store authentication window.
         *
         * @param target Optional events target
         */
        authenticate: (detail, target = document.body) => {
            const e = new AppNavigationEvent(EventTypes.Navigation.Store.authenticate, detail || {});
            target.dispatchEvent(e);
        },
    }),
});
//# sourceMappingURL=NavigationEvents.js.map