
import { URI } from '../../../../base/common/uri.js';
import { localize } from '../../../../nls.js';
import { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';

const chatEditingSnapshotScheme = 'chat-editing-snapshot-text-model';
var ModifiedFileEntryState;
(function (ModifiedFileEntryState) {
    ModifiedFileEntryState[ModifiedFileEntryState["Modified"] = 0] = "Modified";
    ModifiedFileEntryState[ModifiedFileEntryState["Accepted"] = 1] = "Accepted";
    ModifiedFileEntryState[ModifiedFileEntryState["Rejected"] = 2] = "Rejected";
})(ModifiedFileEntryState || (ModifiedFileEntryState = {}));
var ChatEditingSessionState;
(function (ChatEditingSessionState) {
    ChatEditingSessionState[ChatEditingSessionState["Initial"] = 0] = "Initial";
    ChatEditingSessionState[ChatEditingSessionState["StreamingEdits"] = 1] = "StreamingEdits";
    ChatEditingSessionState[ChatEditingSessionState["Idle"] = 2] = "Idle";
    ChatEditingSessionState[ChatEditingSessionState["Disposed"] = 3] = "Disposed";
})(ChatEditingSessionState || (ChatEditingSessionState = {}));
const CHAT_EDITING_MULTI_DIFF_SOURCE_RESOLVER_SCHEME = 'chat-editing-multi-diff-source';
const chatEditingWidgetFileStateContextKey = ( new RawContextKey('chatEditingWidgetFileState', undefined, ( localize(5037, "The current state of the file in the chat editing widget"))));
const chatEditingAgentSupportsReadonlyReferencesContextKey = ( new RawContextKey('chatEditingAgentSupportsReadonlyReferences', undefined, ( localize(
    5038,
    "Whether the chat editing agent supports readonly references (temporary)"
))));
const decidedChatEditingResourceContextKey = ( new RawContextKey('decidedChatEditingResource', []));
const chatEditingResourceContextKey = ( new RawContextKey('chatEditingResource', undefined));
const inChatEditingSessionContextKey = ( new RawContextKey('inChatEditingSession', undefined));
const hasUndecidedChatEditingResourceContextKey = ( new RawContextKey('hasUndecidedChatEditingResource', false));
const hasAppliedChatEditsContextKey = ( new RawContextKey('hasAppliedChatEdits', false));
const applyingChatEditsFailedContextKey = ( new RawContextKey('applyingChatEditsFailed', false));
var ChatEditKind;
(function (ChatEditKind) {
    ChatEditKind[ChatEditKind["Created"] = 0] = "Created";
    ChatEditKind[ChatEditKind["Modified"] = 1] = "Modified";
})(ChatEditKind || (ChatEditKind = {}));
function isChatEditingActionContext(thing) {
    return typeof thing === 'object' && !!thing && 'sessionId' in thing;
}
function getMultiDiffSourceUri(session, showPreviousChanges) {
    return ( URI.from({
        scheme: CHAT_EDITING_MULTI_DIFF_SOURCE_RESOLVER_SCHEME,
        authority: session.chatSessionId,
        query: showPreviousChanges ? 'previous' : undefined,
    }));
}
function parseChatMultiDiffUri(uri) {
    const chatSessionId = uri.authority;
    const showPreviousChanges = uri.query === 'previous';
    return { chatSessionId, showPreviousChanges };
}

export { CHAT_EDITING_MULTI_DIFF_SOURCE_RESOLVER_SCHEME, ChatEditKind, ChatEditingSessionState, ModifiedFileEntryState, applyingChatEditsFailedContextKey, chatEditingAgentSupportsReadonlyReferencesContextKey, chatEditingResourceContextKey, chatEditingSnapshotScheme, chatEditingWidgetFileStateContextKey, decidedChatEditingResourceContextKey, getMultiDiffSourceUri, hasAppliedChatEditsContextKey, hasUndecidedChatEditingResourceContextKey, inChatEditingSessionContextKey, isChatEditingActionContext, parseChatMultiDiffUri };
