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

import { Event } from '@sussudio/base/common/event.mjs';
import { IJSONSchema } from '@sussudio/base/common/jsonSchema.mjs';
import { IDisposable } from '@sussudio/base/common/lifecycle.mjs';
import { TypeConstraint } from '@sussudio/base/common/types.mjs';
import { ServicesAccessor } from '../../instantiation/common/instantiation.mjs';
export declare const ICommandService: import('../../instantiation/common/instantiation.mjs').ServiceIdentifier<ICommandService>;
export interface ICommandEvent {
	commandId: string;
	args: any[];
}
export interface ICommandService {
	readonly _serviceBrand: undefined;
	onWillExecuteCommand: Event<ICommandEvent>;
	onDidExecuteCommand: Event<ICommandEvent>;
	executeCommand<T = any>(commandId: string, ...args: any[]): Promise<T | undefined>;
}
export type ICommandsMap = Map<string, ICommand>;
export interface ICommandHandler {
	(accessor: ServicesAccessor, ...args: any[]): void;
}
export interface ICommand {
	id: string;
	handler: ICommandHandler;
	description?: ICommandHandlerDescription | null;
}
export interface ICommandHandlerDescription {
	readonly description: string;
	readonly args: ReadonlyArray<{
		readonly name: string;
		readonly isOptional?: boolean;
		readonly description?: string;
		readonly constraint?: TypeConstraint;
		readonly schema?: IJSONSchema;
	}>;
	readonly returns?: string;
}
export interface ICommandRegistry {
	onDidRegisterCommand: Event<string>;
	registerCommand(id: string, command: ICommandHandler): IDisposable;
	registerCommand(command: ICommand): IDisposable;
	registerCommandAlias(oldId: string, newId: string): IDisposable;
	getCommand(id: string): ICommand | undefined;
	getCommands(): ICommandsMap;
}
export declare const CommandsRegistry: ICommandRegistry;
