/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import { WebContents } from 'electron';
import { Event } from '@sussudio/base/common/event.mjs';
import { Disposable } from '@sussudio/base/common/lifecycle.mjs';
import { IProcessEnvironment } from '@sussudio/base/common/platform.mjs';
import { IBackupMainService } from '../../backup/electron-main/backup.mjs';
import { IConfigurationService } from '../../configuration/common/configuration.mjs';
import { IDialogMainService } from '../../dialogs/electron-main/dialogMainService.mjs';
import { IEnvironmentMainService } from '../../environment/electron-main/environmentMainService.mjs';
import { IFileService } from '../../files/common/files.mjs';
import { IInstantiationService } from '../../instantiation/common/instantiation.mjs';
import { ILifecycleMainService } from '../../lifecycle/electron-main/lifecycleMainService.mjs';
import { ILogService } from '../../log/common/log.mjs';
import { IProductService } from '../../product/common/productService.mjs';
import { IProtocolMainService } from '../../protocol/electron-main/protocol.mjs';
import { IStateMainService } from '../../state/electron-main/state.mjs';
import { IOpenEmptyWindowOptions } from '../../window/common/window.mjs';
import {
	IOpenConfiguration,
	IOpenEmptyConfiguration,
	IWindowsCountChangedEvent,
	IWindowsMainService,
} from './windows.mjs';
import { IWorkspacesHistoryMainService } from '../../workspaces/electron-main/workspacesHistoryMainService.mjs';
import { IWorkspacesManagementMainService } from '../../workspaces/electron-main/workspacesManagementMainService.mjs';
import { ICodeWindow } from '../../window/electron-main/window.mjs';
import { IThemeMainService } from '../../theme/electron-main/themeMainService.mjs';
import { IPolicyService } from '../../policy/common/policy.mjs';
import { IUserDataProfilesMainService } from '../../userDataProfile/electron-main/userDataProfile.mjs';
export declare class WindowsMainService extends Disposable implements IWindowsMainService {
	private readonly machineId;
	private readonly initialUserEnv;
	private readonly logService;
	private readonly stateMainService;
	private readonly policyService;
	private readonly environmentMainService;
	private readonly userDataProfilesMainService;
	private readonly lifecycleMainService;
	private readonly backupMainService;
	private readonly configurationService;
	private readonly workspacesHistoryMainService;
	private readonly workspacesManagementMainService;
	private readonly instantiationService;
	private readonly dialogMainService;
	private readonly fileService;
	private readonly productService;
	private readonly protocolMainService;
	private readonly themeMainService;
	readonly _serviceBrand: undefined;
	private static readonly WINDOWS;
	private readonly _onDidOpenWindow;
	readonly onDidOpenWindow: Event<ICodeWindow>;
	private readonly _onDidSignalReadyWindow;
	readonly onDidSignalReadyWindow: Event<ICodeWindow>;
	private readonly _onDidDestroyWindow;
	readonly onDidDestroyWindow: Event<ICodeWindow>;
	private readonly _onDidChangeWindowsCount;
	readonly onDidChangeWindowsCount: Event<IWindowsCountChangedEvent>;
	private readonly _onDidTriggerSystemContextMenu;
	readonly onDidTriggerSystemContextMenu: Event<{
		window: ICodeWindow;
		x: number;
		y: number;
	}>;
	private readonly windowsStateHandler;
	constructor(
		machineId: string,
		initialUserEnv: IProcessEnvironment,
		logService: ILogService,
		stateMainService: IStateMainService,
		policyService: IPolicyService,
		environmentMainService: IEnvironmentMainService,
		userDataProfilesMainService: IUserDataProfilesMainService,
		lifecycleMainService: ILifecycleMainService,
		backupMainService: IBackupMainService,
		configurationService: IConfigurationService,
		workspacesHistoryMainService: IWorkspacesHistoryMainService,
		workspacesManagementMainService: IWorkspacesManagementMainService,
		instantiationService: IInstantiationService,
		dialogMainService: IDialogMainService,
		fileService: IFileService,
		productService: IProductService,
		protocolMainService: IProtocolMainService,
		themeMainService: IThemeMainService,
	);
	private registerListeners;
	openEmptyWindow(openConfig: IOpenEmptyConfiguration, options?: IOpenEmptyWindowOptions): Promise<ICodeWindow[]>;
	openExistingWindow(window: ICodeWindow, openConfig: IOpenConfiguration): void;
	open(openConfig: IOpenConfiguration): Promise<ICodeWindow[]>;
	private handleWaitMarkerFile;
	private doOpen;
	private doOpenFilesInExistingWindow;
	private doAddFoldersToExistingWindow;
	private doOpenEmpty;
	private doOpenFolderOrWorkspace;
	private getPathsToOpen;
	private doExtractPathsFromAPI;
	private doExtractPathsFromCLI;
	private cliArgToUri;
	private doGetPathsFromLastSession;
	private getRestoreWindowsSetting;
	private resolveOpenable;
	private doResolveRemoteOpenable;
	private resourceFromOpenable;
	private doResolveFilePath;
	private doResolveRemotePath;
	private shouldOpenNewWindow;
	openExtensionDevelopmentHostWindow(
		extensionDevelopmentPaths: string[],
		openConfig: IOpenConfiguration,
	): Promise<ICodeWindow[]>;
	private openInBrowserWindow;
	private doOpenInBrowserWindow;
	private resolveProfileForBrowserWindow;
	private onWindowClosed;
	getFocusedWindow(): ICodeWindow | undefined;
	getLastActiveWindow(): ICodeWindow | undefined;
	private getLastActiveWindowForAuthority;
	private doGetLastActiveWindow;
	sendToFocused(channel: string, ...args: any[]): void;
	sendToAll(channel: string, payload?: any, windowIdsToIgnore?: number[]): void;
	getWindows(): ICodeWindow[];
	getWindowCount(): number;
	getWindowById(windowId: number): ICodeWindow | undefined;
	getWindowByWebContents(webContents: WebContents): ICodeWindow | undefined;
}
