/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
import { Disposable } from "../../../base/common/lifecycle.mjs";
import { Event } from "../../../base/common/event.mjs";
import { URI } from "../../../base/common/uri.mjs";
import { Metadata } from "./extensionManagement.mjs";
import { IExtension, IExtensionIdentifier } from "../../extensions/common/extensions.mjs";
import { IFileService } from "../../files/common/files.mjs";
import { ILogService } from "../../log/common/log.mjs";
import { IUserDataProfilesService } from "../../userDataProfile/common/userDataProfile.mjs";
import { IUriIdentityService } from "../../uriIdentity/common/uriIdentity.mjs";
import { ITelemetryService } from "../../telemetry/common/telemetry.mjs";
export declare const enum ExtensionsProfileScanningErrorCode {
    /**
     * Error when trying to scan extensions from a profile that does not exist.
     */
    ERROR_PROFILE_NOT_FOUND = "ERROR_PROFILE_NOT_FOUND",
    /**
     * Error when profile file is invalid.
     */
    ERROR_INVALID_CONTENT = "ERROR_INVALID_CONTENT"
}
export declare class ExtensionsProfileScanningError extends Error {
    code: ExtensionsProfileScanningErrorCode;
    constructor(message: string, code: ExtensionsProfileScanningErrorCode);
}
export interface IScannedProfileExtension {
    readonly identifier: IExtensionIdentifier;
    readonly version: string;
    readonly location: URI;
    readonly metadata?: Metadata;
}
export interface ProfileExtensionsEvent {
    readonly extensions: readonly IScannedProfileExtension[];
    readonly profileLocation: URI;
}
export interface DidAddProfileExtensionsEvent extends ProfileExtensionsEvent {
    readonly error?: Error;
}
export interface DidRemoveProfileExtensionsEvent extends ProfileExtensionsEvent {
    readonly error?: Error;
}
export interface IProfileExtensionsScanOptions {
    readonly bailOutWhenFileNotFound?: boolean;
}
export declare const IExtensionsProfileScannerService: import("../../instantiation/common/instantiation.mjs").ServiceIdentifier<IExtensionsProfileScannerService>;
export interface IExtensionsProfileScannerService {
    readonly _serviceBrand: undefined;
    readonly onAddExtensions: Event<ProfileExtensionsEvent>;
    readonly onDidAddExtensions: Event<DidAddProfileExtensionsEvent>;
    readonly onRemoveExtensions: Event<ProfileExtensionsEvent>;
    readonly onDidRemoveExtensions: Event<DidRemoveProfileExtensionsEvent>;
    scanProfileExtensions(profileLocation: URI, options?: IProfileExtensionsScanOptions): Promise<IScannedProfileExtension[]>;
    addExtensionsToProfile(extensions: [IExtension, Metadata | undefined][], profileLocation: URI): Promise<IScannedProfileExtension[]>;
    removeExtensionFromProfile(extension: IExtension, profileLocation: URI): Promise<void>;
}
export declare abstract class AbstractExtensionsProfileScannerService extends Disposable implements IExtensionsProfileScannerService {
    private readonly extensionsLocation;
    private readonly fileService;
    private readonly userDataProfilesService;
    private readonly uriIdentityService;
    private readonly telemetryService;
    private readonly logService;
    readonly _serviceBrand: undefined;
    private readonly _onAddExtensions;
    readonly onAddExtensions: Event<ProfileExtensionsEvent>;
    private readonly _onDidAddExtensions;
    readonly onDidAddExtensions: Event<DidAddProfileExtensionsEvent>;
    private readonly _onRemoveExtensions;
    readonly onRemoveExtensions: Event<ProfileExtensionsEvent>;
    private readonly _onDidRemoveExtensions;
    readonly onDidRemoveExtensions: Event<DidRemoveProfileExtensionsEvent>;
    private readonly resourcesAccessQueueMap;
    constructor(extensionsLocation: URI, fileService: IFileService, userDataProfilesService: IUserDataProfilesService, uriIdentityService: IUriIdentityService, telemetryService: ITelemetryService, logService: ILogService);
    scanProfileExtensions(profileLocation: URI, options?: IProfileExtensionsScanOptions): Promise<IScannedProfileExtension[]>;
    addExtensionsToProfile(extensions: [IExtension, Metadata | undefined][], profileLocation: URI): Promise<IScannedProfileExtension[]>;
    removeExtensionFromProfile(extension: IExtension, profileLocation: URI): Promise<void>;
    private withProfileExtensions;
    private reportAndThrowInvalidConentError;
    private toRelativePath;
    private resolveExtensionLocation;
    private _migrationPromise;
    private migrateFromOldDefaultProfileExtensionsLocation;
    private getResourceAccessQueue;
}
