import { IStringDictionary } from "../../../base/common/collections.js";
import { Event } from "../../../base/common/event.js";
import { IDisposable } from "../../../base/common/lifecycle.js";
import { IExtUri } from "../../../base/common/resources.js";
import { URI } from "../../../base/common/uri.js";
import { IHeaders } from "@codingame/monaco-vscode-912ff6c1-e6aa-58cf-bd7f-50cf27bdb591-common/vscode/vs/base/parts/request/common/request";
import { IEnvironmentService } from "../../environment/common/environment.service.js";
import { IExtensionIdentifier } from "../../extensionManagement/common/extensionManagement.js";
import { IExtensionManifest } from "../../extensions/common/extensions.js";
import { IUserDataProfile, UseDefaultProfileFlags } from "../../userDataProfile/common/userDataProfile.js";
export declare function getDisallowedIgnoredSettings(): string[];
export declare function getDefaultIgnoredSettings(excludeExtensions?: boolean): string[];
export declare function getIgnoredSettingsForExtension(manifest: IExtensionManifest): string[];
export declare const USER_DATA_SYNC_CONFIGURATION_SCOPE = "settingsSync";
export interface IUserDataSyncConfiguration {
    keybindingsPerPlatform?: boolean;
    ignoredExtensions?: string[];
    ignoredSettings?: string[];
}
export declare const CONFIG_SYNC_KEYBINDINGS_PER_PLATFORM = "settingsSync.keybindingsPerPlatform";
export declare function registerConfiguration(): IDisposable;
export interface IUserData {
    ref: string;
    content: string | null;
}
export type IAuthenticationProvider = {
    id: string;
    scopes: string[];
};
export interface IUserDataSyncStore {
    readonly url: URI;
    readonly type: UserDataSyncStoreType;
    readonly defaultUrl: URI;
    readonly stableUrl: URI;
    readonly insidersUrl: URI;
    readonly canSwitch: boolean;
    readonly authenticationProviders: IAuthenticationProvider[];
}
export declare function isAuthenticationProvider(thing: any): thing is IAuthenticationProvider;
export declare enum SyncResource {
    Settings = "settings",
    Keybindings = "keybindings",
    Snippets = "snippets",
    Prompts = "prompts",
    Tasks = "tasks",
    Extensions = "extensions",
    GlobalState = "globalState",
    Profiles = "profiles",
    WorkspaceState = "workspaceState"
}
export declare const ALL_SYNC_RESOURCES: SyncResource[];
export declare function getPathSegments(collection: string | undefined, ...paths: string[]): string[];
export declare function getLastSyncResourceUri(collection: string | undefined, syncResource: SyncResource, environmentService: IEnvironmentService, extUri: IExtUri): URI;
export type IUserDataResourceManifest = Record<ServerResource, string>;
export interface IUserDataCollectionManifest {
    [collectionId: string]: {
        readonly latest?: IUserDataResourceManifest;
    };
}
export interface IUserDataManifest {
    readonly latest?: IUserDataResourceManifest;
    readonly session: string;
    readonly ref: string;
    readonly collections?: IUserDataCollectionManifest;
}
export interface IUserDataActivityData {
    resources?: {
        [resourceId: string]: {
            created: number;
            content: string;
        }[];
    };
    collections?: {
        [collectionId: string]: {
            resources?: {
                [resourceId: string]: {
                    created: number;
                    content: string;
                }[];
            } | undefined;
        };
    };
}
export interface IResourceRefHandle {
    ref: string;
    created: number;
}
export type ServerResource = SyncResource | "machines" | "editSessions" | "workspaceState";
export type UserDataSyncStoreType = "insiders" | "stable";
export declare const HEADER_OPERATION_ID = "x-operation-id";
export declare const HEADER_EXECUTION_ID = "X-Execution-Id";
export declare function createSyncHeaders(executionId: string): IHeaders;
export declare enum UserDataSyncErrorCode {
    Unauthorized = "Unauthorized",
    Forbidden = "Forbidden",
    NotFound = "NotFound",
    MethodNotFound = "MethodNotFound",
    Conflict = "Conflict",
    Gone = "Gone",
    PreconditionFailed = "PreconditionFailed",
    TooLarge = "TooLarge",
    UpgradeRequired = "UpgradeRequired",
    PreconditionRequired = "PreconditionRequired",
    TooManyRequests = "RemoteTooManyRequests",
    TooManyRequestsAndRetryAfter = "TooManyRequestsAndRetryAfter",
    RequestFailed = "RequestFailed",
    RequestCanceled = "RequestCanceled",
    RequestTimeout = "RequestTimeout",
    RequestProtocolNotSupported = "RequestProtocolNotSupported",
    RequestPathNotEscaped = "RequestPathNotEscaped",
    RequestHeadersNotObject = "RequestHeadersNotObject",
    NoCollection = "NoCollection",
    NoRef = "NoRef",
    EmptyResponse = "EmptyResponse",
    TurnedOff = "TurnedOff",
    SessionExpired = "SessionExpired",
    ServiceChanged = "ServiceChanged",
    DefaultServiceChanged = "DefaultServiceChanged",
    LocalTooManyProfiles = "LocalTooManyProfiles",
    LocalTooManyRequests = "LocalTooManyRequests",
    LocalPreconditionFailed = "LocalPreconditionFailed",
    LocalInvalidContent = "LocalInvalidContent",
    LocalError = "LocalError",
    IncompatibleLocalContent = "IncompatibleLocalContent",
    IncompatibleRemoteContent = "IncompatibleRemoteContent",
    Unknown = "Unknown"
}
export declare class UserDataSyncError extends Error {
    readonly code: UserDataSyncErrorCode;
    readonly resource?: SyncResource | undefined;
    readonly operationId?: string | undefined;
    constructor(message: string, code: UserDataSyncErrorCode, resource?: SyncResource | undefined, operationId?: string | undefined);
}
export declare class UserDataSyncStoreError extends UserDataSyncError {
    readonly url: string;
    readonly serverCode: number | undefined;
    constructor(message: string, url: string, code: UserDataSyncErrorCode, serverCode: number | undefined, operationId: string | undefined);
}
export declare class UserDataAutoSyncError extends UserDataSyncError {
    constructor(message: string, code: UserDataSyncErrorCode);
}
export declare namespace UserDataSyncError {
    function toUserDataSyncError(error: Error): UserDataSyncError;
}
export interface ISyncUserDataProfile {
    readonly id: string;
    readonly collection: string;
    readonly name: string;
    readonly icon?: string;
    readonly useDefaultFlags?: UseDefaultProfileFlags;
}
export type ISyncExtension = ILocalSyncExtension | IRemoteSyncExtension;
export interface ILocalSyncExtension {
    identifier: IExtensionIdentifier;
    pinned: boolean;
    version: string;
    preRelease: boolean;
    disabled?: boolean;
    installed?: boolean;
    isApplicationScoped?: boolean;
    state?: IStringDictionary<any>;
}
export interface IRemoteSyncExtension {
    identifier: IExtensionIdentifier;
    version: string;
    pinned?: boolean;
    preRelease?: boolean;
    disabled?: boolean;
    installed?: boolean;
    isApplicationScoped?: boolean;
    state?: IStringDictionary<any>;
}
export interface IStorageValue {
    version: number;
    value: string;
}
export interface IGlobalState {
    storage: IStringDictionary<IStorageValue>;
}
export interface IWorkspaceState {
    folders: IWorkspaceStateFolder[];
    storage: IStringDictionary<string>;
    version: number;
}
export interface IWorkspaceStateFolder {
    resourceUri: string;
    workspaceFolderIdentity: string;
}
export declare enum SyncStatus {
    Uninitialized = "uninitialized",
    Idle = "idle",
    Syncing = "syncing",
    HasConflicts = "hasConflicts"
}
export interface ISyncResourceHandle {
    created: number;
    uri: URI;
}
export interface IRemoteUserData {
    ref: string;
    syncData: ISyncData | null;
}
export interface ISyncData {
    version: number;
    machineId?: string;
    content: string;
}
export declare enum Change {
    None = 0,
    Added = 1,
    Modified = 2,
    Deleted = 3
}
export declare enum MergeState {
    Preview = "preview",
    Conflict = "conflict",
    Accepted = "accepted"
}
export interface IResourcePreview {
    readonly baseResource: URI;
    readonly remoteResource: URI;
    readonly localResource: URI;
    readonly previewResource: URI;
    readonly acceptedResource: URI;
    readonly localChange: Change;
    readonly remoteChange: Change;
    readonly mergeState: MergeState;
}
export interface IUserDataSyncResource {
    readonly syncResource: SyncResource;
    readonly profile: IUserDataProfile;
}
export interface IUserDataSyncResourceConflicts extends IUserDataSyncResource {
    readonly conflicts: IResourcePreview[];
}
export interface IUserDataSyncResourcePreview extends IUserDataSyncResource {
    readonly isLastSyncFromCurrentMachine: boolean;
    readonly resourcePreviews: IResourcePreview[];
}
export interface IUserDataSyncResourceError extends IUserDataSyncResource {
    readonly error: UserDataSyncError;
}
export interface IUserDataSyncResourceInitializer {
    initialize(userData: IUserData): Promise<void>;
}
export interface IUserDataSynchroniser {
    readonly resource: SyncResource;
    readonly status: SyncStatus;
    readonly onDidChangeStatus: Event<SyncStatus>;
    readonly conflicts: IUserDataSyncResourceConflicts;
    readonly onDidChangeConflicts: Event<IUserDataSyncResourceConflicts>;
    readonly onDidChangeLocal: Event<void>;
    sync(manifest: IUserDataResourceManifest | null, preview: boolean, userDataSyncConfiguration: IUserDataSyncConfiguration, headers: IHeaders): Promise<IUserDataSyncResourcePreview | null>;
    accept(resource: URI, content?: string | null): Promise<IUserDataSyncResourcePreview | null>;
    apply(force: boolean, headers: IHeaders): Promise<IUserDataSyncResourcePreview | null>;
    stop(): Promise<void>;
    hasPreviouslySynced(): Promise<boolean>;
    hasLocalData(): Promise<boolean>;
    resetLocal(): Promise<void>;
    resolveContent(resource: URI): Promise<string | null>;
    replace(content: string): Promise<boolean>;
}
export declare const SYNC_SERVICE_URL_TYPE = "sync.store.url.type";
export declare function getEnablementKey(resource: SyncResource): string;
export interface IUserDataSyncTask {
    readonly manifest: IUserDataManifest | null;
    run(): Promise<void>;
    stop(): Promise<void>;
}
export interface IUserDataManualSyncTask {
    readonly id: string;
    merge(): Promise<void>;
    apply(): Promise<void>;
    stop(): Promise<void>;
}
export type SyncOptions = {
    immediately?: boolean;
    skipIfSyncedRecently?: boolean;
    disableCache?: boolean;
};
export interface IConflictSetting {
    key: string;
    localValue: any | undefined;
    remoteValue: any | undefined;
}
export declare const USER_DATA_SYNC_LOG_ID = "userDataSync";
export declare const USER_DATA_SYNC_SCHEME = "vscode-userdata-sync";
export declare const PREVIEW_DIR_NAME = "preview";
