import { ServiceIdentifier } from '../../../../platform/instantiation/common/instantiation.js';
import { Event } from '../../../../base/common/event.js';
import { IDisposable } from '../../../../base/common/lifecycle.js';
import { URI } from '../../../../base/common/uri.js';
import { IBaseFileStat } from '../../../../platform/files/common/files.js';
import { IMarkdownString } from '../../../../base/common/htmlContent.js';
import { EditorInput } from '../../../common/editor/editorInput.js';
import { SaveReason } from '../../../common/editor.js';

interface IAutoSaveConfiguration {
    autoSave?: 'afterDelay' | 'onFocusChange' | 'onWindowChange';
    autoSaveDelay?: number;
    autoSaveWorkspaceFilesOnly?: boolean;
    autoSaveWhenNoErrors?: boolean;
}
declare const enum AutoSaveMode {
    OFF = 0,
    AFTER_SHORT_DELAY = 1,
    AFTER_LONG_DELAY = 2,
    ON_FOCUS_CHANGE = 3,
    ON_WINDOW_CHANGE = 4
}
declare const enum AutoSaveDisabledReason {
    SETTINGS = 1,
    OUT_OF_WORKSPACE = 2,
    ERRORS = 3,
    DISABLED = 4
}
type IAutoSaveMode = IEnabledAutoSaveMode | IDisabledAutoSaveMode;
interface IEnabledAutoSaveMode {
    readonly mode: AutoSaveMode.AFTER_SHORT_DELAY | AutoSaveMode.AFTER_LONG_DELAY | AutoSaveMode.ON_FOCUS_CHANGE | AutoSaveMode.ON_WINDOW_CHANGE;
}
interface IDisabledAutoSaveMode {
    readonly mode: AutoSaveMode.OFF;
    readonly reason: AutoSaveDisabledReason;
}
declare const IFilesConfigurationService: ServiceIdentifier<IFilesConfigurationService>;
interface IFilesConfigurationService {
    readonly _serviceBrand: undefined;
    readonly onDidChangeAutoSaveConfiguration: Event<void>;
    readonly onDidChangeAutoSaveDisabled: Event<URI>;
    getAutoSaveConfiguration(resourceOrEditor: EditorInput | URI | undefined): IAutoSaveConfiguration;
    hasShortAutoSaveDelay(resourceOrEditor: EditorInput | URI | undefined): boolean;
    getAutoSaveMode(resourceOrEditor: EditorInput | URI | undefined, saveReason?: SaveReason): IAutoSaveMode;
    toggleAutoSave(): Promise<void>;
    disableAutoSave(resourceOrEditor: EditorInput | URI): IDisposable;
    readonly onDidChangeReadonly: Event<void>;
    isReadonly(resource: URI, stat?: IBaseFileStat): boolean | IMarkdownString;
    updateReadonly(resource: URI, readonly: true | false | 'toggle' | 'reset'): Promise<void>;
    readonly onDidChangeFilesAssociation: Event<void>;
    readonly isHotExitEnabled: boolean;
    readonly hotExitConfiguration: string | undefined;
    preventSaveConflicts(resource: URI, language?: string): boolean;
}

export { AutoSaveDisabledReason, AutoSaveMode, type IAutoSaveConfiguration, type IAutoSaveMode, type IDisabledAutoSaveMode, type IEnabledAutoSaveMode, IFilesConfigurationService };
