
import { localize } from '../../../../nls.js';
import { RawContextKey, ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
import { IsWebContext } from '../../../../platform/contextkey/common/contextkeys.js';
import { RemoteNameContext } from '../../../common/contextkeys.js';
import { ChatEntitlementContextKeys } from '../../../services/chat/common/chatEntitlementService.js';
import { ChatModeKind } from './constants.js';

var ChatContextKeys;
(function (ChatContextKeys) {
    ChatContextKeys.responseVote = ( new RawContextKey(
        'chatSessionResponseVote',
        '',
        { type: 'string', description: ( localize(
            5542,
            "When the response has been voted up, is set to 'up'. When voted down, is set to 'down'. Otherwise an empty string."
        )) }
    ));
    ChatContextKeys.responseDetectedAgentCommand = ( new RawContextKey(
        'chatSessionResponseDetectedAgentOrCommand',
        false,
        { type: 'boolean', description: ( localize(5543, "When the agent or command was automatically detected")) }
    ));
    ChatContextKeys.responseSupportsIssueReporting = ( new RawContextKey(
        'chatResponseSupportsIssueReporting',
        false,
        { type: 'boolean', description: ( localize(5544, "True when the current chat response supports issue reporting.")) }
    ));
    ChatContextKeys.responseIsFiltered = ( new RawContextKey(
        'chatSessionResponseFiltered',
        false,
        { type: 'boolean', description: ( localize(5545, "True when the chat response was filtered out by the server.")) }
    ));
    ChatContextKeys.responseHasError = ( new RawContextKey(
        'chatSessionResponseError',
        false,
        { type: 'boolean', description: ( localize(5546, "True when the chat response resulted in an error.")) }
    ));
    ChatContextKeys.requestInProgress = ( new RawContextKey(
        'chatSessionRequestInProgress',
        false,
        { type: 'boolean', description: ( localize(5547, "True when the current request is still in progress.")) }
    ));
    ChatContextKeys.currentlyEditing = ( new RawContextKey(
        'chatSessionCurrentlyEditing',
        false,
        { type: 'boolean', description: ( localize(5548, "True when the current request is being edited.")) }
    ));
    ChatContextKeys.currentlyEditingInput = ( new RawContextKey(
        'chatSessionCurrentlyEditingInput',
        false,
        { type: 'boolean', description: ( localize(5549, "True when the current request input at the bottom is being edited.")) }
    ));
    ChatContextKeys.isResponse = ( new RawContextKey('chatResponse', false, { type: 'boolean', description: ( localize(5550, "The chat item is a response.")) }));
    ChatContextKeys.isRequest = ( new RawContextKey('chatRequest', false, { type: 'boolean', description: ( localize(5551, "The chat item is a request")) }));
    ChatContextKeys.itemId = ( new RawContextKey('chatItemId', '', { type: 'string', description: ( localize(5552, "The id of the chat item.")) }));
    ChatContextKeys.lastItemId = ( new RawContextKey('chatLastItemId', [], { type: 'string', description: ( localize(5553, "The id of the last chat item.")) }));
    ChatContextKeys.editApplied = ( new RawContextKey('chatEditApplied', false, { type: 'boolean', description: ( localize(5554, "True when the chat text edits have been applied.")) }));
    ChatContextKeys.inputHasText = ( new RawContextKey('chatInputHasText', false, { type: 'boolean', description: ( localize(5555, "True when the chat input has text.")) }));
    ChatContextKeys.inputHasFocus = ( new RawContextKey('chatInputHasFocus', false, { type: 'boolean', description: ( localize(5556, "True when the chat input has focus.")) }));
    ChatContextKeys.inChatInput = ( new RawContextKey('inChatInput', false, { type: 'boolean', description: ( localize(5557, "True when focus is in the chat input, false otherwise.")) }));
    ChatContextKeys.inChatSession = ( new RawContextKey('inChat', false, { type: 'boolean', description: ( localize(5558, "True when focus is in the chat widget, false otherwise.")) }));
    ChatContextKeys.inChatEditor = ( new RawContextKey('inChatEditor', false, { type: 'boolean', description: ( localize(5559, "Whether focus is in a chat editor.")) }));
    ChatContextKeys.hasPromptFile = ( new RawContextKey(
        'chatPromptFileAttached',
        false,
        { type: 'boolean', description: ( localize(5560, "True when the chat has a prompt file attached.")) }
    ));
    ChatContextKeys.chatModeKind = ( new RawContextKey(
        'chatMode',
        ChatModeKind.Ask,
        { type: 'string', description: ( localize(5561, "The 'kind' of the current chat mode- Agent for custom modes.")) }
    ));
    ChatContextKeys.chatToolCount = ( new RawContextKey('chatToolCount', 0, { type: 'number', description: ( localize(5562, "The number of tools available in the current chat mode.")) }));
    ChatContextKeys.chatToolGroupingThreshold = ( new RawContextKey(
        'chat.toolGroupingThreshold',
        0,
        { type: 'number', description: ( localize(5563, "The number of tools at which we start doing virtual grouping.")) }
    ));
    ChatContextKeys.supported = ( ContextKeyExpr.or(( IsWebContext.negate()), ( RemoteNameContext.notEqualsTo('')), ( ContextKeyExpr.has('config.chat.experimental.serverlessWebEnabled'))));
    ChatContextKeys.enabled = ( new RawContextKey('chatIsEnabled', false, { type: 'boolean', description: ( localize(
        5564,
        "True when chat is enabled because a default chat participant is activated with an implementation."
    )) }));
    ChatContextKeys.lockedToCodingAgent = ( new RawContextKey(
        'lockedToCodingAgent',
        false,
        { type: 'boolean', description: ( localize(5565, "True when the chat widget is locked to the coding agent session.")) }
    ));
    ChatContextKeys.withinEditSessionDiff = ( new RawContextKey(
        'withinEditSessionDiff',
        false,
        { type: 'boolean', description: ( localize(5566, "True when the chat widget dispatches to the edit session chat.")) }
    ));
    ChatContextKeys.filePartOfEditSession = ( new RawContextKey(
        'filePartOfEditSession',
        false,
        { type: 'boolean', description: ( localize(5567, "True when the chat widget is within a file with an edit session.")) }
    ));
    ChatContextKeys.extensionParticipantRegistered = ( new RawContextKey(
        'chatPanelExtensionParticipantRegistered',
        false,
        { type: 'boolean', description: ( localize(
            5568,
            "True when a default chat participant is registered for the panel from an extension."
        )) }
    ));
    ChatContextKeys.panelParticipantRegistered = ( new RawContextKey(
        'chatPanelParticipantRegistered',
        false,
        { type: 'boolean', description: ( localize(5569, "True when a default chat participant is registered for the panel.")) }
    ));
    ChatContextKeys.chatEditingCanUndo = ( new RawContextKey(
        'chatEditingCanUndo',
        false,
        { type: 'boolean', description: ( localize(
            5570,
            "True when it is possible to undo an interaction in the editing panel."
        )) }
    ));
    ChatContextKeys.chatEditingCanRedo = ( new RawContextKey(
        'chatEditingCanRedo',
        false,
        { type: 'boolean', description: ( localize(
            5571,
            "True when it is possible to redo an interaction in the editing panel."
        )) }
    ));
    ChatContextKeys.languageModelsAreUserSelectable = ( new RawContextKey(
        'chatModelsAreUserSelectable',
        false,
        { type: 'boolean', description: ( localize(5572, "True when the chat model can be selected manually by the user.")) }
    ));
    ChatContextKeys.extensionInvalid = ( new RawContextKey(
        'chatExtensionInvalid',
        false,
        { type: 'boolean', description: ( localize(
            5573,
            "True when the installed chat extension is invalid and needs to be updated."
        )) }
    ));
    ChatContextKeys.inputCursorAtTop = ( new RawContextKey('chatCursorAtTop', false));
    ChatContextKeys.inputHasAgent = ( new RawContextKey('chatInputHasAgent', false));
    ChatContextKeys.location = ( new RawContextKey('chatLocation', undefined));
    ChatContextKeys.inQuickChat = ( new RawContextKey('quickChatHasFocus', false, { type: 'boolean', description: ( localize(5574, "True when the quick chat UI has focus, false otherwise.")) }));
    ChatContextKeys.hasFileAttachments = ( new RawContextKey(
        'chatHasFileAttachments',
        false,
        { type: 'boolean', description: ( localize(5575, "True when the chat has file attachments.")) }
    ));
    ChatContextKeys.remoteJobCreating = ( new RawContextKey(
        'chatRemoteJobCreating',
        false,
        { type: 'boolean', description: ( localize(5576, "True when a remote coding agent job is being created.")) }
    ));
    ChatContextKeys.hasRemoteCodingAgent = ( new RawContextKey('hasRemoteCodingAgent', false, ( localize(5577, "Whether any remote coding agent is available"))));
    ChatContextKeys.enableRemoteCodingAgentPromptFileOverlay = ( new RawContextKey('enableRemoteCodingAgentPromptFileOverlay', false, ( localize(
        5578,
        "Whether the remote coding agent prompt file overlay feature is enabled"
    ))));
    ChatContextKeys.skipChatRequestInProgressMessage = ( new RawContextKey(
        'chatSkipRequestInProgressMessage',
        false,
        { type: 'boolean', description: ( localize(5579, "True when the chat request in progress message should be skipped.")) }
    ));
    ChatContextKeys.Setup = ChatEntitlementContextKeys.Setup;
    ChatContextKeys.Entitlement = ChatEntitlementContextKeys.Entitlement;
    ChatContextKeys.chatQuotaExceeded = ChatEntitlementContextKeys.chatQuotaExceeded;
    ChatContextKeys.completionsQuotaExceeded = ChatEntitlementContextKeys.completionsQuotaExceeded;
    ChatContextKeys.Editing = {
        hasToolConfirmation: ( new RawContextKey(
            'chatHasToolConfirmation',
            false,
            { type: 'boolean', description: ( localize(5580, "True when a tool confirmation is present.")) }
        )),
    };
    ChatContextKeys.Tools = {
        toolsCount: ( new RawContextKey('toolsCount', 0, { type: 'number', description: ( localize(5581, "The count of tools available in the chat.")) }))
    };
    ChatContextKeys.Modes = {
        hasCustomChatModes: ( new RawContextKey(
            'chatHasCustomChatModes',
            false,
            { type: 'boolean', description: ( localize(5582, "True when the chat has custom chat modes available.")) }
        )),
    };
    ChatContextKeys.panelLocation = ( new RawContextKey(
        'chatPanelLocation',
        undefined,
        { type: 'number', description: ( localize(5583, "The location of the chat panel.")) }
    ));
    ChatContextKeys.inEmptyStateWithHistoryEnabled = ( new RawContextKey(
        'chatInEmptyStateWithHistoryEnabled',
        false,
        { type: 'boolean', description: ( localize(
            5584,
            "True when chat empty state history is enabled AND chat is in empty state."
        )) }
    ));
    ChatContextKeys.sessionType = ( new RawContextKey('chatSessionType', '', { type: 'string', description: ( localize(5585, "The type of the current chat session item.")) }));
    ChatContextKeys.isHistoryItem = ( new RawContextKey('chatIsHistoryItem', false, { type: 'boolean', description: ( localize(5586, "True when the chat session item is from history.")) }));
    ChatContextKeys.isActiveSession = ( new RawContextKey(
        'chatIsActiveSession',
        false,
        { type: 'boolean', description: ( localize(5587, "True when the chat session is currently active (not deletable).")) }
    ));
})(ChatContextKeys || (ChatContextKeys = {}));
var ChatContextKeyExprs;
(function (ChatContextKeyExprs) {
    ChatContextKeyExprs.inEditingMode = ( ContextKeyExpr.or(( ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Edit)), ( ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Agent))));
    ChatContextKeyExprs.chatSetupTriggerContext = ( ContextKeyExpr.or(( ChatContextKeys.Setup.installed.negate()), ChatContextKeys.Entitlement.canSignUp));
})(ChatContextKeyExprs || (ChatContextKeyExprs = {}));

export { ChatContextKeyExprs, ChatContextKeys };
