/* oxlint-disable no-template-curly-in-string -- descriptor data contains literal GitLens format tokens */
import type { SettingsCategory } from '../model.js';

export const annotationsCategories: SettingsCategory[] = [
	{
		id: 'current-line',
		settingsSearch: 'gitlens.currentLine',
		name: 'Inline Blame',
		group: 'Annotations',
		icon: 'eye',
		hint: 'Adds an unobtrusive blame annotation at the end of the current line',
		master: {
			kind: 'check',
			key: 'currentLine.enabled',
			label: 'Inline Blame',
			addSettingsOff: [['hovers.currentLine.over', 'line']],
		},
		command: { label: 'GitLens: Toggle Line Blame Annotations', command: 'gitlens.toggleLineBlame' },
		learnMoreUrl: 'https://help.gitkraken.com/gitlens/gitlens-features/#current-line-blame',
		preview: 'blame',
		controls: [
			{
				kind: 'check',
				key: 'currentLine.pullRequests.enabled',
				label: 'Show the Pull Request (if any) that introduced the commit',
				enabledWhen: 'currentLine.enabled',
			},
			{
				kind: 'info',
				text: 'Requires a connection to a supported remote service (e.g. GitHub)',
				visibleWhen: 'currentLine.pullRequests.enabled',
			},
			{
				kind: 'text',
				key: 'currentLine.format',
				label: 'Annotation format',
				placeholder: "${author, }${agoOrDate}${' via 'pullRequest}${ • message|50?}",
				defaultValue: "${author, }${agoOrDate}${' via 'pullRequest}${ • message|50?}",
				preview: { type: 'commit', default: "${author, }${agoOrDate}${' via 'pullRequest}${ • message|50?}" },
				tokens: true,
				enabledWhen: 'currentLine.enabled',
			},
			{
				kind: 'check',
				key: 'currentLine.useUncommittedChangesFormat',
				type: 'custom',
				label: 'Override format for uncommitted changes',
				enabledWhen: 'currentLine.enabled',
			},
			{
				kind: 'text',
				key: 'currentLine.uncommittedChangesFormat',
				label: 'Uncommitted changes format',
				placeholder: 'format for uncommitted changes',
				defaultValue: '',
				preview: { type: 'commit-uncommitted', default: '' },
				tokens: true,
				enabledWhen: 'currentLine.enabled',
				visibleWhen: 'currentLine.useUncommittedChangesFormat',
				indent: true,
			},
			{
				kind: 'check',
				key: 'currentLine.scrollable',
				label: 'Include the annotation when scrolling the editor horizontally',
				hint: 'When enabled the annotation can be scrolled into view when it is outside the viewport.',
				enabledWhen: 'currentLine.enabled',
			},
			{
				kind: 'info',
				text: 'Setting this to false will inhibit the hovers from showing over the annotation; Set gitlens.hovers.currentLine.over to line to enable the hovers to show anywhere over the line.',
			},
		],
	},
	{
		id: 'code-lens',
		settingsSearch: 'gitlens.codeLens',
		name: 'Git CodeLens',
		group: 'Annotations',
		icon: 'gl-commit-horizontal',
		hint: 'Adds authorship CodeLens to the top of files and on code blocks',
		master: {
			kind: 'check',
			key: 'codeLens.enabled',
			label: 'Git CodeLens',
		},
		command: { label: 'GitLens: Toggle Git CodeLens', command: 'gitlens.toggleCodeLens' },
		learnMoreUrl: 'https://help.gitkraken.com/gitlens/gitlens-features/#git-codelens',
		preview: 'codelens',
		controls: [
			{
				kind: 'check',
				key: 'codeLens.recentChange.enabled',
				label: 'Add the author and date of the most recent change for the file or code block',
				enabledWhen: 'codeLens.enabled',
			},
			{
				kind: 'check',
				key: 'codeLens.recentChange.command',
				label: 'When clicked',
				valueOn: 'gitlens.showQuickCommitFileDetails',
				enabledWhen: 'codeLens.enabled & codeLens.recentChange.enabled',
				indent: true,
			},
			{
				kind: 'select',
				key: 'codeLens.recentChange.command',
				label: 'When clicked',
				options: [
					{ value: 'gitlens.toggleFileBlame', label: 'toggles the file blame' },
					{ value: 'gitlens.toggleFileHeatmap', label: 'toggles the file heatmap' },
					{ value: 'gitlens.toggleFileChanges', label: 'toggles the file changes since before the commit' },
					{ value: 'gitlens.toggleFileChangesOnly', label: 'toggles the file changes from the commit' },
					{ value: 'gitlens.diffWithPrevious', label: 'opens changes with the previous revision' },
					{ value: 'gitlens.revealCommitInView', label: 'reveals the commit in the Side Bar' },
					{ value: 'gitlens.showCommitsInView', label: 'shows details of the commit' },
					{ value: 'gitlens.showQuickCommitDetails', label: 'shows quick details of the commit' },
					{
						value: 'gitlens.showQuickCommitFileDetails',
						label: 'shows quick file details of the commit (default)',
					},
					{ value: 'gitlens.showQuickFileHistory', label: 'shows the current file history' },
					{ value: 'gitlens.showQuickRepoHistory', label: 'shows the current branch history' },
					{
						value: 'gitlens.openCommitOnRemote',
						label: 'opens the commit on the remote service (when available)',
					},
					{
						value: 'gitlens.copyRemoteCommitUrl',
						label: 'copies the remote commit URL to the clipboard (when available)',
					},
					{
						value: 'gitlens.openFileOnRemote',
						label: 'opens the file revision on the remote service (when available)',
					},
					{
						value: 'gitlens.copyRemoteFileUrl',
						label: 'copies the remote file revision URL to the clipboard (when available)',
					},
				],
				enabledWhen: 'codeLens.enabled & codeLens.recentChange.enabled & codeLens.recentChange.command !false',
				indent: true,
			},
			{
				kind: 'check',
				key: 'codeLens.authors.enabled',
				label: 'Add the number of authors and the most prominent author of the file or code block',
				enabledWhen: 'codeLens.enabled',
			},
			{
				kind: 'check',
				key: 'codeLens.authors.command',
				label: 'When clicked',
				valueOn: 'gitlens.toggleFileBlame',
				enabledWhen: 'codeLens.enabled & codeLens.authors.enabled',
				indent: true,
			},
			{
				kind: 'select',
				key: 'codeLens.authors.command',
				label: 'When clicked',
				options: [
					{ value: 'gitlens.toggleFileBlame', label: 'toggles the file blame (default)' },
					{ value: 'gitlens.toggleFileHeatmap', label: 'toggles the file heatmap' },
					{ value: 'gitlens.toggleFileChanges', label: 'toggles the file changes since before the commit' },
					{ value: 'gitlens.toggleFileChangesOnly', label: 'toggles the file changes from the commit' },
					{ value: 'gitlens.diffWithPrevious', label: 'opens changes with the previous revision' },
					{ value: 'gitlens.revealCommitInView', label: 'reveals the commit in the Side Bar' },
					{ value: 'gitlens.showCommitsInView', label: 'searches for commits within the range' },
					{ value: 'gitlens.showQuickCommitDetails', label: 'shows quick details of the commit' },
					{ value: 'gitlens.showQuickCommitFileDetails', label: 'show quick file details of the commit' },
					{ value: 'gitlens.showQuickFileHistory', label: 'shows the current file history' },
					{ value: 'gitlens.showQuickRepoHistory', label: 'shows the current branch history' },
					{
						value: 'gitlens.openCommitOnRemote',
						label: 'opens the commit on the remote service (when available)',
					},
					{
						value: 'gitlens.copyRemoteCommitUrl',
						label: 'copies the remote commit URL to the clipboard (when available)',
					},
					{
						value: 'gitlens.copyRemoteFileUrl',
						label: 'copies the remote file revision URL to the clipboard (when available)',
					},
					{
						value: 'gitlens.openFileOnRemote',
						label: 'opens the file revision on the remote service (when available)',
					},
				],
				enabledWhen: 'codeLens.enabled & codeLens.authors.enabled & codeLens.authors.command !false',
				indent: true,
			},
			{
				kind: 'checkgroup',
				key: 'codeLens.scopes',
				label: 'Add CodeLens to the following scopes',
				options: [
					{ value: 'document', label: 'File scope', hint: 'At the top of the file' },
					{
						value: 'containers',
						label: 'Containers scope',
						hint: 'At the start of modules, classes, interfaces, etc',
					},
					{ value: 'blocks', label: 'Block scope', hint: 'At the start of functions, methods, etc' },
				],
				enabledWhen: 'codeLens.enabled',
			},
		],
	},
	{
		id: 'status-bar',
		settingsSearch: 'gitlens.statusBar',
		name: 'Status Bar Blame',
		group: 'Annotations',
		icon: 'git-commit',
		hint: 'Adds a Git blame annotation about the current line to the status bar',
		master: {
			kind: 'check',
			key: 'statusBar.enabled',
			label: 'Status Bar Blame',
		},
		learnMoreUrl: 'https://help.gitkraken.com/gitlens/gitlens-features/#status-bar-blame',
		preview: 'statusbar',
		controls: [
			{
				kind: 'check',
				key: 'statusBar.pullRequests.enabled',
				label: 'Show the Pull Request (if any) that introduced the commit',
				enabledWhen: 'statusBar.enabled',
			},
			{
				kind: 'info',
				text: 'Requires a connection to a supported remote service (e.g. GitHub)',
				visibleWhen: 'statusBar.pullRequests.enabled',
			},
			{
				kind: 'text',
				key: 'statusBar.format',
				label: 'Annotation format',
				placeholder: "${author}, ${agoOrDate}${' via 'pullRequest}",
				defaultValue: "${author}, ${agoOrDate}${' via 'pullRequest}",
				preview: { type: 'commit', default: "${author}, ${agoOrDate}${' via 'pullRequest}" },
				tokens: true,
				enabledWhen: 'statusBar.enabled',
			},
			{
				kind: 'segmented',
				key: 'statusBar.alignment',
				label: 'Position the annotation on the',
				options: [
					{ value: 'left', label: 'left' },
					{ value: 'right', label: 'right' },
				],
				enabledWhen: 'statusBar.enabled',
			},
			{
				kind: 'select',
				key: 'statusBar.command',
				label: 'When clicked',
				options: [
					{ value: 'gitlens.toggleFileBlame', label: 'toggles the file blame' },
					{ value: 'gitlens.toggleFileHeatmap', label: 'toggles the file heatmap' },
					{ value: 'gitlens.toggleFileChanges', label: 'toggles the file changes since before the commit' },
					{ value: 'gitlens.toggleFileChangesOnly', label: 'toggles the file changes from the commit' },
					{ value: 'gitlens.toggleCodeLens', label: 'toggles the Git CodeLens' },
					{ value: 'gitlens.diffWithPrevious', label: 'opens line changes with the previous revision' },
					{ value: 'gitlens.diffWithWorking', label: 'opens line changes with the working file' },
					{ value: 'gitlens.revealCommitInView', label: 'reveals the commit in the Side Bar' },
					{ value: 'gitlens.showCommitsInView', label: 'shows details of the commit' },
					{ value: 'gitlens.showQuickCommitDetails', label: 'shows quick details of the commit (default)' },
					{ value: 'gitlens.showQuickCommitFileDetails', label: 'shows quick file details of the commit' },
					{ value: 'gitlens.showQuickFileHistory', label: 'shows the current file history' },
					{ value: 'gitlens.showQuickRepoHistory', label: 'shows the current branch history' },
					{
						value: 'gitlens.openCommitOnRemote',
						label: 'opens the commit on the remote service (when available)',
					},
					{
						value: 'gitlens.copyRemoteCommitUrl',
						label: 'copies the remote commit URL to the clipboard (when available)',
					},
					{
						value: 'gitlens.openFileOnRemote',
						label: 'opens the file revision on the remote service (when available)',
					},
					{
						value: 'gitlens.copyRemoteFileUrl',
						label: 'copies the remote file revision URL to the clipboard (when available)',
					},
				],
				enabledWhen: 'statusBar.enabled',
			},
			{
				kind: 'check',
				key: 'statusBar.reduceFlicker',
				label: 'Reduce flashing when updating the annotation',
				hint: 'Avoids clearing the previous blame information when changing lines to reduce status bar "flashing"',
				enabledWhen: 'statusBar.enabled',
			},
		],
	},
	{
		id: 'hovers',
		settingsSearch: 'gitlens.hovers',
		name: 'Hovers',
		group: 'Annotations',
		icon: 'comment',
		hint: 'Adds detailed blame information accessible via hovers',
		master: {
			kind: 'check',
			key: 'hovers.enabled',
			label: 'Hovers',
		},
		learnMoreUrl: 'https://help.gitkraken.com/gitlens/gitlens-features/#hovers',
		preview: 'hover',
		controls: [
			{
				kind: 'check',
				key: 'hovers.avatars',
				label: 'Use author avatars',
				enabledWhen: 'hovers.enabled',
			},
			{
				kind: 'check',
				key: 'hovers.autolinks.enabled',
				label: 'Show autolinks in commit messages',
				enabledWhen: 'hovers.enabled',
			},
			{
				kind: 'check',
				key: 'hovers.autolinks.enhanced',
				label: 'Enhance autolinks with remote details',
				hint: 'Requires a connection to a supported remote service (e.g. GitHub)',
				enabledWhen: 'hovers.enabled & hovers.autolinks.enabled',
				indent: true,
			},
			{
				kind: 'check',
				key: 'hovers.pullRequests.enabled',
				label: 'Show the Pull Request (if any) that introduced the commit',
				enabledWhen: 'hovers.enabled',
			},
			{
				kind: 'info',
				text: 'Requires a connection to a supported remote service (e.g. GitHub)',
				visibleWhen: 'hovers.pullRequests.enabled',
			},
			{
				kind: 'check',
				key: 'hovers.currentLine.enabled',
				label: 'Show hovers for the current line',
				enabledWhen: 'hovers.enabled',
				visibleWhen: 'currentLine.enabled',
			},
			{
				kind: 'check',
				key: 'hovers.currentLine.enabled',
				label: 'Show hovers for the current line',
				addSettingsOn: [['hovers.currentLine.over', 'line']],
				enabledWhen: 'hovers.enabled',
				visibleWhen: 'currentLine.enabled =false',
			},
			{
				kind: 'select',
				key: 'hovers.currentLine.over',
				label: 'Shown when over the',
				options: [
					{ value: 'annotation', label: 'annotation only' },
					{ value: 'line', label: 'line & annotation' },
				],
				enabledWhen: 'hovers.enabled & hovers.currentLine.enabled',
				visibleWhen: 'currentLine.enabled',
				indent: true,
			},
			{
				kind: 'select',
				key: 'hovers.currentLine.over',
				label: 'Shown when over the',
				options: [
					{ value: 'annotation', label: 'annotation only' },
					{ value: 'line', label: 'line' },
				],
				enabledWhen: 'hovers.enabled & hovers.currentLine.enabled & currentLine.enabled',
				visibleWhen: 'currentLine.enabled =false',
				indent: true,
			},
			{
				kind: 'check',
				key: 'hovers.currentLine.details',
				label: 'Add blame details',
				enabledWhen: 'hovers.enabled & hovers.currentLine.enabled',
				indent: true,
			},
			{
				kind: 'check',
				key: 'hovers.currentLine.changes',
				label: 'Add changes (diff)',
				enabledWhen: 'hovers.enabled & hovers.currentLine.enabled',
				indent: true,
			},
			{
				kind: 'check',
				key: 'hovers.annotations.enabled',
				label: 'Show hovers while annotating',
				enabledWhen: 'hovers.enabled',
			},
			{
				kind: 'select',
				key: 'hovers.annotations.over',
				label: 'Shown when over the',
				options: [
					{ value: 'annotation', label: 'annotation only' },
					{ value: 'line', label: 'line & annotation' },
				],
				enabledWhen: 'hovers.enabled & hovers.annotations.enabled',
				indent: true,
			},
			{
				kind: 'check',
				key: 'hovers.annotations.details',
				label: 'Add blame details',
				enabledWhen: 'hovers.enabled & hovers.annotations.enabled',
				indent: true,
			},
			{
				kind: 'check',
				key: 'hovers.annotations.changes',
				label: 'Add changes (diff)',
				enabledWhen: 'hovers.enabled & hovers.annotations.enabled',
				indent: true,
			},
		],
	},
];
