import {Util} from "./Util.js";
import {UtilActors} from "./UtilActors.js";
import {UtilCompat} from "./UtilCompat.js";

class ConfigConsts {
	static _template_getEntityPermissions (help) {
		const out = MiscUtil.copy(ConfigConsts._TEMPLATE_ENTITY_PERMISSIONS);
		out.values = Util.Fvtt.getPermissionsEnum();
		out.help = help;
		return out;
	}

	static _template_getTokenSettings () {
		return {
			tokenNameDisplay: {
				name: "Token Name Display Mode",
				help: `The default Display Name mode for imported tokens.`,
				default: 20,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: 0,
						name: "None",
					},
					{
						value: 10,
						name: "Control",
					},
					{
						value: 20,
						name: "Owner Hover",
					},
					{
						value: 30,
						name: "Hover",
					},
					{
						value: 40,
						name: "Owner",
					},
					{
						value: 50,
						name: "Always",
					},
				],
			},
			tokenDisposition: {
				name: "Token Disposition",
				help: `The default Token Disposition mode for imported tokens.`,
				default: -1,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: -1,
						name: "Hostile",
					},
					{
						value: 0,
						name: "Neutral",
					},
					{
						value: 1,
						name: "Friendly",
					},
				],
			},
			tokenLockRotation: {
				name: "Token Lock Rotation",
				help: `The default Lock Rotation mode for imported tokens.`,
				default: ConfigConsts.C_USE_PLUT_VALUE,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: ConfigConsts.C_USE_PLUT_VALUE,
						name: "Allow Importer to Set",
					},
				],
			},
			tokenIsAddVision: {
				name: "Enable Token Vision",
				help: `Enable vision for tokens.`,
				default: ConfigConsts.C_BOOL_ENABLED,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: ConfigConsts.C_BOOL_DISABLED,
						name: "Disabled",
					},
					{
						value: ConfigConsts.C_BOOL_ENABLED,
						name: "Enabled",
					},
				],
			},
			tokenDimSight: {
				name: "Token Dim Vision Distance",
				help: `How token Dim Vision (Distance) should be set.`,
				default: ConfigConsts.C_USE_PLUT_VALUE,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: ConfigConsts.C_USE_PLUT_VALUE,
						name: "Allow Importer to Set",
					},
				],
			},
			tokenBrightSight: {
				name: "Token Bright Vision Distance",
				help: `How token Bright Vision (Distance) should be set.`,
				default: ConfigConsts.C_USE_PLUT_VALUE,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: ConfigConsts.C_USE_PLUT_VALUE,
						name: "Allow Importer to Set",
					},
				],
			},
			tokenSightAngle: {
				name: "Token Sight Angle",
				help: `How token Sight Angle (Degrees) should be set.`,
				default: ConfigConsts.C_USE_PLUT_VALUE,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: ConfigConsts.C_USE_PLUT_VALUE,
						name: "Allow Importer to Set",
					},
				],
			},
			tokenDimLight: {
				name: "Token Dim Light Radius",
				help: `How token Dim Light Radius (Distance) should be set.`,
				default: ConfigConsts.C_USE_PLUT_VALUE,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: ConfigConsts.C_USE_PLUT_VALUE,
						name: "Allow Importer to Set",
					},
				],
			},
			tokenBrightLight: {
				name: "Token Bright Light Radius",
				help: `How token Bright Light Radius (Distance) should be set.`,
				default: ConfigConsts.C_USE_PLUT_VALUE,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: ConfigConsts.C_USE_PLUT_VALUE,
						name: "Allow Importer to Set",
					},
				],
			},
			tokenLightAngle: {
				name: "Token Light Emission Angle",
				help: `How token Light Emission (Angle) should be set.`,
				default: ConfigConsts.C_USE_PLUT_VALUE,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: ConfigConsts.C_USE_PLUT_VALUE,
						name: "Allow Importer to Set",
					},
				],
			},
			tokenLightColor: {
				name: "Token Light Color",
				help: `How token Light Color should be set.`,
				default: ConfigConsts.C_USE_PLUT_VALUE,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: ConfigConsts.C_USE_PLUT_VALUE,
						name: "Allow Importer to Set",
					},
				],
			},
			tokenLightAlpha: {
				name: "Token Light Intensity",
				help: `How token Color Intensity should be set.`,
				default: ConfigConsts.C_USE_PLUT_VALUE,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: ConfigConsts.C_USE_PLUT_VALUE,
						name: "Allow Importer to Set",
					},
				],
			},
			tokenLightAnimationType: {
				name: "Token Light Animation Type",
				help: `How token Light Animation Type should be set.`,
				default: ConfigConsts.C_USE_PLUT_VALUE,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: ConfigConsts.C_USE_PLUT_VALUE,
						name: "Allow Importer to Set",
					},
				],
			},
			tokenLightAnimationSpeed: {
				name: "Token Light Animation Speed",
				help: `How token Light Animation Speed should be set.`,
				default: ConfigConsts.C_USE_PLUT_VALUE,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: ConfigConsts.C_USE_PLUT_VALUE,
						name: "Allow Importer to Set",
					},
				],
			},
			tokenLightAnimationIntensity: {
				name: "Token Light Animation Intensity",
				help: `How token Light Animation Intensity should be set.`,
				default: ConfigConsts.C_USE_PLUT_VALUE,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: ConfigConsts.C_USE_PLUT_VALUE,
						name: "Allow Importer to Set",
					},
				],
			},
			tokenBarDisplay: {
				name: "Token Bar Display Mode",
				help: `The default Display Bars mode for imported tokens.`,
				default: 40,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_USE_GAME_DEFAULT,
						name: "Use Game Setting",
					},
					{
						value: 0,
						name: "None",
					},
					{
						value: 10,
						name: "Control",
					},
					{
						value: 20,
						name: "Owner Hover",
					},
					{
						value: 30,
						name: "Hover",
					},
					{
						value: 40,
						name: "Owner",
					},
					{
						value: 50,
						name: "Always",
					},
				],
			},
			tokenBar1Attribute: {
				name: "Token Bar 1 Attribute",
				help: `The default token bar 1 attribute for imported creature tokens.`,
				default: "attributes.hp",
				type: "enum",
				values: () => [
					{value: ConfigConsts.C_USE_GAME_DEFAULT, name: "Use Game Setting"},
					...UtilActors.getModelBarAttributes(game.system.model.Actor.npc),
				],
				isNullable: true,
			},
			tokenBar2Attribute: {
				name: "Token Bar 2 Attribute",
				help: `The default token bar 2 attribute for imported creature tokens.`,
				default: null,
				type: "enum",
				values: () => [
					{value: ConfigConsts.C_USE_GAME_DEFAULT, name: "Use Game Setting"},
					...UtilActors.getModelBarAttributes(game.system.model.Actor.npc),
				],
				isNullable: true,
			},
		};
	}
}

ConfigConsts._TEMPLATE_ENTITY_PERMISSIONS = {
	name: "Default Permissions",
	default: 0,
	type: "enum",
};

// region Compendiums
ConfigConsts.SRD_COMPENDIUMS_CREATURES = ["dnd5e.monsters"];
ConfigConsts.SRD_COMPENDIUMS_CREATURE_FEATURES = ["dnd5e.monsterfeatures"];
ConfigConsts.SRD_COMPENDIUMS_CLASSES = ["dnd5e.classes"];
ConfigConsts.SRD_COMPENDIUMS_CLASS_FEATURES = ["dnd5e.classfeatures"];
ConfigConsts.SRD_COMPENDIUMS_ITEMS = ["dnd5e.items", "dnd5e.tradegoods"];
ConfigConsts.SRD_COMPENDIUMS_SPELLS = ["dnd5e.spells"];
ConfigConsts.SRD_COMPENDIUMS_OPTIONAL_FEATURES = ["dnd5e.classfeatures"];
ConfigConsts.SRD_COMPENDIUMS_RACES_AND_FEATURES = ["dnd5e.races"];
// endregion

// region Constants
ConfigConsts.C_ART_IMAGE_MODE_TOKEN = 0;
ConfigConsts.C_ART_IMAGE_MODE_TILE = 1;
ConfigConsts.C_ART_IMAGE_MODE_NOTE = 2;
ConfigConsts.C_ART_IMAGE_MODE_SCENE = 3;

ConfigConsts.C_IMPORT_DEDUPE_MODE_NONE = 0;
ConfigConsts.C_IMPORT_DEDUPE_MODE_SKIP = 1;
ConfigConsts.C_IMPORT_DEDUPE_MODE_OVERWRITE = 2;

ConfigConsts.C_IMPORT_DRAG_DROP_MODE_NEVER = 0;
ConfigConsts.C_IMPORT_DRAG_DROP_MODE_PROMPT = 1;
ConfigConsts.C_IMPORT_DRAG_DROP_MODE_ALWAYS = 2;

ConfigConsts.C_CREATURE_NAMETAGS_CR = 0;
ConfigConsts.C_CREATURE_NAMETAGS_TYPE = 1;
ConfigConsts.C_CREATURE_NAMETAGS_TYPE_WITH_TAGS = 2;

ConfigConsts.C_ITEM_ATTUNEMENT_NONE = 0;
ConfigConsts.C_ITEM_ATTUNEMENT_REQUIRED = 1;
ConfigConsts.C_ITEM_ATTUNEMENT_ATTUNED = 2;

ConfigConsts.C_USE_GAME_DEFAULT = "VE_USE_GAME_DEFAULT";
ConfigConsts.C_USE_PLUT_VALUE = "VE_USE_MODULE_VALUE";
ConfigConsts.C_BOOL_DISABLED = 0;
ConfigConsts.C_BOOL_ENABLED = 1;
// endregion

ConfigConsts.DEFAULT_CONFIG_ = {
	ui: {
		name: "UI",
		settings: {
			isStreamerMode: {
				name: "Streamer Mode",
				help: "Remove identifiable 5etools/Plutonium references from the UI.",
				default: false,
				type: "boolean",
				isReloadRequired: true,
				isPlayerEditable: true,
			},
			isShowPopout: {
				name: "Enable Sheet Popout Buttons",
				help: `Add a "Popout" button to sheet headers, which opens the sheet as a popup browser window.`,
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isCompactWindowBar: {
				name: "Compact Header Buttons",
				help: `Combine the Plutonium-specific header buttons into a single dropdown, and re-style other header buttons to match.`,
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isCompactDirectoryButtons: {
				name: "Compact Directory Buttons",
				help: `Reduce the height of "Create X"/"Create Folder" buttons in the directory, to offset the additional space requirements of Plutonium's UI.`,
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isCompactChat: {
				name: "Compact Chat",
				help: "Make various tweaks to the appearance of chat, in order to fit more on-screen. Hold down SHIFT while hovering over a message to expand it, revealing its header and delete button.",
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isCompactScenes: {
				name: "Compact Scenes Directory",
				help: "Reduce the height of scene thumbnails in the Scenes Directory, to fit more on-screen.",
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isCompactActors: {
				name: "Compact Actors Directory",
				help: "Reduce the height of Actors Directory directory items, to fit more on-screen.",
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isCompactItems: {
				name: "Compact Items Directory",
				help: "Reduce the height of Items Directory directory items, to fit more on-screen.",
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isCompactJournal: {
				name: "Compact Journal Entries",
				help: "Reduce the height of Journal Entries directory items, to fit more on-screen.",
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isCompactTables: {
				name: "Compact Rollable Tables",
				help: "Reduce the height of Rollable Tables directory items, to fit more on-screen.",
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isCompactMacros: {
				name: "Compact Macros",
				help: "Reduce the height of Macro directory items, to fit more on-screen.",
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isHidePlutoniumDirectoryButtons: {
				name: "Hide Directory Buttons",
				help: `Hide the Plutonium directory buttons.`,
				default: false,
				type: "boolean",
			},
			isNameTabFromScene: {
				name: "Prepend Active Scene Name to Browser Tab Name",
				help: "Sets the browser tab name to be that of the currently-active scene.",
				default: true,
				type: "boolean",
			},
			tabNameSuffix: {
				name: "Tab Name Suffix",
				help: `Requires the "Name Browser Tab After Active Scene" option to be enabled. A custom name suffix to append to the scene name displayed in the tab (separated by a Foundry-style bullet character).`,
				default: null,
				isNullable: true,
				type: "string",
			},
			isDisplayBackendStatus: {
				name: "Display Detected Backend",
				help: `Adds a cool green hacker tint to the Foundry "anvil" logo in the top-left corner of the screen if Plutonium's backend is detected.`,
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isExpandActiveEffectConfig: {
				name: "Enhance Active Effect Config UI",
				help: `Adds a list of potential active effect attribute keys to the Configure Active Effect window's "Effects" tab, and a field for configuring priority.`,
				default: true,
				type: "boolean",
				compatibilityModeValues: {
					[UtilCompat.MODULE_DAE]: false,
				},
			},
			isAddDeleteToSceneNavOptions: {
				name: `Add "Delete" to Navbar Scene Context Menu`,
				help: `Adds a "Delete" option to the context menu found when right-clicking a scene in the navigation bar. Note that this does not include the currently-active scene.`,
				default: true,
				type: "boolean",
			},
		},
		settingsAdvanced: {
			isHideGmOnlyConfig: {
				name: "Hide GM-Only Config",
				help: `If enabled, a player viewing the config will see only the limited subset of settings they are allowed to modify. If disabled, a player viewing the config will see all settings, regardless of whether or not they can modify those settings.`,
				default: true,
				type: "boolean",
			},
			isDisableLargeImportWarning: {
				name: "Disable Large Import Warning",
				help: `Disable the warning confirmation dialogue shown when importing a large number of entities.`,
				default: false,
				type: "boolean",
				isPlayerEditable: true,
			},
		},
		settingsHacks: {
			isFastAnimations: {
				name: "Fast Animations",
				help: "Increase the speed of various UI animations.",
				// N.B.: avoid making this default, as it causes sheet "close()" calls to mysteriously fail to set the
				//   sheet "_state" flag to CLOSED (instead leaving them on CLOSING) for some users. Was unable to
				//   reproduce, but having users run:
				//   `CONFIG.Actor.collection.instance.forEach(it => Object.values(it.apps).forEach(it => it._state = it._state === -2 ? -1 : it._state))`
				//   successfully "unstuck" their sheets.
				default: false,
				type: "boolean",
				isPlayerEditable: true,
			},
			isFixEscapeKey: {
				name: "Fix ESC Key",
				help: `Bind the "Escape" key to (in this order): de-select active input fields; de-select selected canvas elements; close context menus; close individual windows in most-recently-active-first order; toggle the main menu.`,
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isAddOpenMainMenuButtonToSettings: {
				name: `Add "Open Game Menu" Button if "Fix ESC Key" Is Enabled`,
				help: `Add an alternate "Open Game Menu" button to the Settings tab if the "Fix ESC Key" Config option is enabled. This allows you to quickly open the main menu without first having to close all open windows.`,
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isFixDrawingFreehandMinDistance: {
				name: "Fix Freehand Drawing Minimum Distance",
				help: `Reduce the minimum mouse movement distance required to start a freehand drawing.`,
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
		},
	},
	tokens: {
		name: "Tokens",
		settings: {
			isDisplayDamageDealt: {
				name: "Display Missing Health",
				help: `This allows players to see "damage dealt" to a token, without revealing the token's total health. If enabled, each token's missing health is displayed as a number in the bottom-right corner of the token.`,
				default: false,
				type: "boolean",
			},
			isFastAnimations: {
				name: "Disable Animations",
				help: "Disable token animations.",
				default: false,
				type: "boolean",
			},
		},
	},
	import: {
		name: "Import",
		settings: {
			isAddSourceToName: {
				name: "Add Source to Names",
				help: `If the source of each imported entry (e.g. "MM" for Monster Manual) should be appended to the name of the entry.`,
				default: false,
				type: "boolean",
				isPlayerEditable: true,
			},
			isAddPageNumberToSource: {
				name: "Add Page Numbers to Sources",
				help: `If the page number (where available) of each imported entry should be appended to the "source" field of the entry.`,
				default: false,
				type: "boolean",
				isPlayerEditable: true,
			},
			isRendererLinksDisabled: {
				name: "Disable 5etools Links",
				help: `Prevents links to other 5etools content from being added to the text of imported 5etools content.`,
				default: false,
				type: "boolean",
				isPlayerEditable: true,
			},
			deduplicationMode: {
				name: "Duplicate Handling Mode",
				help: `Determines what action is taken when importing duplicate content to a directory or compendium. An entity is considered a duplicate if and only if its name and source match an existing entity. Note that this does not function when importing to actor sheets.`,
				default: 0,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_IMPORT_DEDUPE_MODE_NONE,
						name: `None`,
						help: `No deduplication is done.`,
					},
					{
						value: ConfigConsts.C_IMPORT_DEDUPE_MODE_SKIP,
						name: `Skip Duplicates`,
						help: `If a duplicate is found for a would-be imported entity, that entity is not imported.`,
					},
					{
						value: ConfigConsts.C_IMPORT_DEDUPE_MODE_OVERWRITE,
						name: `Update Existing`,
						help: `If a duplicate is found for a would-be import entity, the existing entity is updated.`,
					},
				],
			},
			minimumRole: {
				name: "Minimum Permission Level for Import",
				help: `"Import" buttons will be hidden for any user with a role less than the chosen role.`,
				default: CONST.USER_ROLES.NONE,
				type: "enum",
				values: [
					{
						value: CONST.USER_ROLES.NONE,
						name: `None`,
					},
					{
						value: CONST.USER_ROLES.PLAYER,
						name: `Player`,
					},
					{
						value: CONST.USER_ROLES.TRUSTED,
						name: `Trusted`,
					},
					{
						value: CONST.USER_ROLES.ASSISTANT,
						name: `Assistant`,
					},
					{
						value: CONST.USER_ROLES.GAMEMASTER,
						name: `Gamemaster`,
					},
				],
			},
			dragDropMode: {
				name: "Use Importer when Drag-Dropping Items to Actors",
				help: `Some Foundry items (backgrounds, races, spells, items, etc.), when imported via Plutonium and later drag-dropped to an actor sheet, have special handling allowing for greater functionality (such as populating skills and features). This allows you to control whether or not that special handling is used, rather than the baseline Foundry drag-drop. Note that if you modify an item, the changes will not be reflected in the version imported to the sheet by Plutonium.`,
				default: ConfigConsts.C_IMPORT_DRAG_DROP_MODE_PROMPT,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_IMPORT_DRAG_DROP_MODE_NEVER,
						name: `Never`,
					},
					{
						value: ConfigConsts.C_IMPORT_DRAG_DROP_MODE_PROMPT,
						name: `Prompt`,
					},
					{
						value: ConfigConsts.C_IMPORT_DRAG_DROP_MODE_ALWAYS,
						name: `Always`,
					},
				],
				isPlayerEditable: true,
			},
			isUseOtherFormulaFieldForSaveHalvesDamage: {
				name: `Treat "Save Halves" Additional Attack Damage as "Other Formula"`,
				help: `This moves extra attack damage rolls (for example, the poison damage done by a Giant Spider's bite) to the "Other Formula" dice field, which can improve compatibility with some modules.`,
				default: false,
				type: "boolean",
			},
		},
		settingsAdvanced: {
			baseSiteUrl: {
				name: "Base Site URL",
				help: `The root server URL from which to load data and source images, and to link in rendered text. Note that, where possible, the module will use its own built-in data files, rather than call out to a remote server. Note that this should end with a forward slash ("/").`,
				type: "string",
				default: null,
				isNullable: true,
				isReloadRequired: true,
			},
			isNoLocalData: {
				name: "Avoid Loading Local Data",
				help: `If enabled, any data which would normally be loaded from the module's local copies is instead loaded from the sites URL (which may be customised by editing the "Base Site Url" config option)`,
				default: false,
				type: "boolean",
			},
			isUseLocalImages: {
				name: "Use Local Images",
				help: `If enabled, images will be sourced from an "img" directory within the module's directory. This directory should contain the contents of the "5eTools image files" ZIP, available from https://get.5e.tools.`,
				default: false,
				type: "boolean",
				isReloadRequired: true,
			},
			isStrictMatching: {
				name: "Use Strict Entity Matching",
				help: `If enabled, any Plutonium feature which searches for existing data (for example, the class importer attempting to find existing class levels in a given class) will match by name and source. If disabled, only name is used.`,
				default: false,
				type: "boolean",
				isPlayerEditable: true,
			},
			baseBrewUrl: {
				name: "Base Homebrew Repository URL",
				help: `The root GitHub repository URL from which to load data and source images, and to link in rendered text, when importing homebrew content.`,
				type: "string",
				default: null,
				isNullable: true,
				isReloadRequired: true,
			},
		},
	},
	importCreature: {
		name: "Import (Creatures)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported creature.`),
			isImportBio: {
				name: "Import Fluff to Biography",
				help: `If enabled, any fluff text which is available for a creature will be imported into that creature's biography.`,
				default: true,
				type: "boolean",
			},
			isImportBioImages: {
				name: "Include Fluff Image to Biography",
				help: `If enabled, any fluff image which is available for a creature will be imported into that creature's biography.`,
				default: false,
				type: "boolean",
			},
			...ConfigConsts._template_getTokenSettings(),
			itemWeightAndValueSizeScaling: {
				name: "Item Weight & Value Scaling",
				help: `The method by which to scale the weights and values of non-standard-sizes items carried by creatures.`,
				default: 1,
				type: "enum",
				values: [
					{
						value: 1,
						name: "No scaling",
					},
					{
						value: 2,
						name: `"Barding" scaling (multiplicative)`,
						help: `Based on the rules for calculating the weight and cost of barding, as presented in the Player's Handbook (p. 155).`,
					},
					{
						value: 3,
						name: `"Gurt's Greataxe" scaling (exponential)`,
						help: `Based on the giant-size greateaxe of the same name found in Storm King's Thunder (p. 234).`,
					},
				],
			},
			spellcastingPrimaryTraitMode: {
				name: "Spellcasting Primary Trait Selection Method",
				help: `The method by which a primary spellcasting trait (i.e., the spellcasting trait used to set spellcasting ability, spell DC, and spell attack bonus) is selected if a creature has multiple spellcasting traits with associated ability scores.`,
				default: 1,
				type: "enum",
				values: [
					{
						value: 1,
						name: "Highest spell count",
						help: `Use whichever spellcasting trait has the most spells listed.`,
					},
					{
						value: 2,
						name: `Highest ability score`,
						help: `Use whichever spellcasting trait has the highest associated ability score. Note that this may prefer innate spellcasting traits over spellcasting class levels.`,
					},
				],
			},
			nameTags: {
				name: "Add Tag Suffixes to Names",
				help: `Add tags to an imported creature's name, to allow easier searching (especially within compendiums).`,
				default: {
					[ConfigConsts.C_CREATURE_NAMETAGS_CR]: false,
					[ConfigConsts.C_CREATURE_NAMETAGS_TYPE]: false,
					[ConfigConsts.C_CREATURE_NAMETAGS_TYPE_WITH_TAGS]: false,
				},
				type: "multipleChoice",
				choices: [
					"Add [CR] tag",
					"Add [type] tag",
					"Add [type (with tags)] tag",
				],
			},
		},
		settingsAdvanced: {
			additionalDataCompendium: {
				name: "Additional Data Compendiums",
				help: `A comma-separated list of compendiums that the creature importer will attempt to pull additional data (including art) from rather than use the default Plutonium icons.`,
				default: ConfigConsts.SRD_COMPENDIUMS_CREATURES.join(", "),
				type: "string",
				isNullable: true,
			},
			additionalDataCompendiumFeatures: {
				name: "Additional Data Compendiums (Features)",
				help: `A comma-separated list of compendiums that the creature importer will attempt to pull additional data (including art) from rather than use the default Plutonium icons.`,
				default: ConfigConsts.SRD_COMPENDIUMS_CREATURE_FEATURES.join(", "),
				type: "string",
				isNullable: true,
			},
			isUseTokenImageAsPortrait: {
				name: "Use Token Image as Portrait",
				help: `If enabled, a creature's token image will be preferred over its portrait image when populating its sheet portrait during import.`,
				default: false,
				type: "boolean",
			},
		},
	},
	importVehicle: {
		name: "Import (Vehicles)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported vehicle.`),
			...ConfigConsts._template_getTokenSettings(),
			isImportBio: {
				name: "Import Fluff to Description",
				help: `If enabled, any fluff text which is available for a vehicle will be imported into that vehicle's description.`,
				default: true,
				type: "boolean",
			},
			isImportBioImages: {
				name: "Include Fluff Image to Description",
				help: `If enabled, any fluff image which is available for a vehicle will be imported into that creature's description.`,
				default: false,
				type: "boolean",
			},
		},
		settingsAdvanced: {
			additionalDataCompendium: {
				name: "Additional Data Compendiums",
				help: `A comma-separated list of compendiums that the vehicle importer will attempt to pull additional data (including art) from rather than use the default Plutonium icons.`,
				default: "",
				type: "string",
				isNullable: true,
			},
			isUseTokenImageAsPortrait: {
				name: "Use Token Image as Portrait",
				help: `If enabled, a vehicle's token image will be preferred over its portrait image when populating its sheet portrait during import.`,
				default: false,
				type: "boolean",
			},
		},
	},
	importVehicleUpgrade: {
		name: "Import (Vehicle Upgrades)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported vehicle upgrades.`),
		},
		settingsAdvanced: {
			isImportDescription: {
				name: "Import Text as Description",
				help: `If enabled, a vehicle upgrade's text will be imported as item description.`,
				default: true,
				type: "boolean",
			},
		},
	},
	importObject: {
		name: "Import (Objects)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported object.`),
			...ConfigConsts._template_getTokenSettings(),
		},
	},
	importFeat: {
		name: "Import (Feats)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported feat.`),
		},
		settingsAdvanced: {
			isImportDescription: {
				name: "Import Text as Description",
				help: `If enabled, a feat's text will be imported as item description.`,
				default: true,
				type: "boolean",
			},
		},
	},
	importBackground: {
		name: "Import (Backgrounds)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported background.`),
		},
		settingsAdvanced: {
			isImportDescription: {
				name: "Import Text as Description",
				help: `If enabled, a background's text will be imported as item description.`,
				default: true,
				type: "boolean",
			},
		},
	},
	importClass: {
		name: "Import (Classes)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported class or subclass.`),
			isAddBaseAcActiveEffect: {
				name: "Add Base AC Active Effect",
				help: `If enabled, importing a class will create a "Base AC" active effect (calculated as 10 + dexterity modifier), unless one already exists.`,
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isImportClassTable: {
				name: "Import Class Table to Description",
				help: `If enabled, a class's table will be imported as part of the class item's description.`,
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isAddLevelUpButton: {
				name: `Add "Level Up" Button to Character Sheets`,
				help: `If enabled, a "Level Up" button will be displayed in the top-right corner of a character's sheet (assuming the default dnd5e sheet is used).`,
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
		},
		settingsAdvanced: {
			additionalDataCompendium: {
				name: "Additional Data Compendiums (Classes)",
				help: `A comma-separated list of compendiums that the class importer will attempt to pull additional data (including art) from rather than use the default Plutonium icons.`,
				default: ConfigConsts.SRD_COMPENDIUMS_CLASSES.join(", "),
				type: "string",
				isNullable: true,
			},
			additionalDataCompendiumFeatures: {
				name: "Additional Data Compendiums (Features)",
				help: `A comma-separated list of compendiums that the class importer will attempt to pull additional data (including art) from rather than use the default Plutonium icons.`,
				default: ConfigConsts.SRD_COMPENDIUMS_CLASS_FEATURES.join(", "),
				type: "string",
				isNullable: true,
			},
			isImportDescription: {
				name: "Import Text as Description",
				help: `If enabled, a class's text will be imported as item description.`,
				default: true,
				type: "boolean",
			},
		},
	},
	importClassSubclassFeature: {
		name: "Import (Class & Sub Features)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported class/subclass feature.`),
		},
		settingsAdvanced: {
			isImportDescription: {
				name: "Import Text as Description",
				help: `If enabled, a class/subclass feature's text will be imported as item description.`,
				default: true,
				type: "boolean",
			},
		},
	},
	importItem: {
		name: "Import (Items)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported item.`),
			isAddActiveEffects: {
				name: "Populate Active Effects",
				help: `If items should have active effects created during import.`,
				default: true,
				type: "boolean",
				// No player editable, since calculations are different with/without this option
			},
			isMetric: {
				name: "Convert Item Weights to Metric",
				help: "Whether or not item weight units should be converted to an approximate metric equivalent (1 pound \u2248 0.5 kilograms).",
				default: false,
				type: "boolean",
			},
			isSplitPacksActor: {
				name: "Import Packs to Actors as Constituent Items",
				help: `If "pack" items (explorer's pack, dungeoneer's pack) should be broken down and imported as their constituent items when importing to an actor's items.`,
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			isSplitAtomicPacksActor: {
				name: "Import Item Stacks to Actors as Constituent Items",
				help: `If an item which is formed of multiple constituent items of the same type, such as "Bag of Ball Bearings (1,000)", should be split up into its constituent items (a "Ball Bearing" item with its sheet quantity set to 1,000, in this example).`,
				default: false,
				type: "boolean",
				isPlayerEditable: true,
			},
			throwables: {
				name: "Throwing Items",
				help: `A list of items which are imported with their usage set to deplete their own quantity when used.`,
				default: ["Handaxe", "Javelin", "Light Hammer", "Dart", "Net"],
				type: "arrayStringShort",
				isPlayerEditable: true,
			},
			attunementType: {
				name: "Attunement Type for Attunable Items",
				help: `The attunement type to use when importing an item which can be attuned.`,
				default: ConfigConsts.C_ITEM_ATTUNEMENT_REQUIRED,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_ITEM_ATTUNEMENT_NONE,
						name: `None`,
					},
					{
						value: ConfigConsts.C_ITEM_ATTUNEMENT_REQUIRED,
						name: `Attunement Required`,
					},
					{
						value: ConfigConsts.C_ITEM_ATTUNEMENT_ATTUNED,
						name: `Attuned`,
					},
				],
			},
			isImportDescriptionHeader: {
				name: "Include Damage, Properties, Rarity, and Attunement in Description",
				help: `If enabled, an imported item's description will include text generated from its rarity, attunement requirements, damage, and other properties.`,
				default: false,
				type: "boolean",
				isPlayerEditable: true,
			},
		},
		settingsAdvanced: {
			additionalDataCompendium: {
				name: "Additional Data Compendiums",
				help: `A comma-separated list of compendiums that the item importer will attempt to pull additional data (including art) from rather than use the default Plutonium icons.`,
				default: ConfigConsts.SRD_COMPENDIUMS_ITEMS.join(", "),
				type: "string",
				isNullable: true,
			},
			isImportDescription: {
				name: "Import Text as Description",
				help: `If enabled, an item's text will be imported as item description.`,
				default: true,
				type: "boolean",
			},
		},
	},
	importPsionic: {
		name: "Import (Psionics)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported psionic.`),
		},
		settingsAdvanced: {
			isImportDescription: {
				name: "Import Text as Description",
				help: `If enabled, a psionic's text will be imported as item description.`,
				default: true,
				type: "boolean",
			},
		},
	},
	importRace: {
		name: "Import (Races)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported race.`),
		},
		settingsAdvanced: {
			additionalDataCompendium: {
				name: "Additional Data Compendiums (Races)",
				help: `A comma-separated list of compendiums that the race importer will attempt to pull additional data (including art) from rather than use the default Plutonium icons.`,
				default: ConfigConsts.SRD_COMPENDIUMS_RACES_AND_FEATURES.join(", "),
				type: "string",
				isNullable: true,
			},
			additionalDataCompendiumFeatures: {
				name: "Additional Data Compendiums (Features)",
				help: `A comma-separated list of compendiums that the race importer will attempt to pull additional data (including art) from rather than use the default Plutonium icons.`,
				default: ConfigConsts.SRD_COMPENDIUMS_RACES_AND_FEATURES.join(", "),
				type: "string",
				isNullable: true,
			},
			isImportDescription: {
				name: "Import Text as Description",
				help: `If enabled, a race's text will be imported as item description.`,
				default: true,
				type: "boolean",
			},
		},
	},
	importTable: {
		name: "Import (Table)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported table.`),
		},
	},
	importSpell: {
		name: "Import (Spells)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported spell.`),
			prepareActorSpells: {
				name: "Prepare Actor Spells",
				help: "Whether or not spells that are imported to actor sheets should be prepared by default.",
				default: true,
				type: "boolean",
				isPlayerEditable: true,
			},
			prepareSpellItems: {
				name: "Prepare Spell Items",
				help: "Whether or not spells that are imported to the items directory should be prepared by default.",
				default: false,
				type: "boolean",
			},
			actorSpellPreparationMode: {
				name: "Actor Spell Preparation Mode",
				help: `The default spell preparation mode for spells imported to actor sheets.`,
				default: "prepared",
				type: "enum",
				values: [
					{
						value: "",
						name: "(None)",
					},
					{
						value: "always",
						name: "Always Available",
					},
					{
						value: "prepared",
						name: "Prepared",
					},
					{
						value: "innate",
						name: "Innate Spellcasting",
					},
					{
						value: "pact",
						name: "Pact Magic",
					},
				],
				isPlayerEditable: true,
			},
			spellItemPreparationMode: {
				name: "Spell Item Preparation Mode",
				help: `The default spell preparation mode for spells imported to the items directory.`,
				default: "prepared",
				type: "enum",
				values: [
					{
						value: "",
						name: "(None)",
					},
					{
						value: "always",
						name: "Always Available",
					},
					{
						value: "prepared",
						name: "Prepared",
					},
					{
						value: "innate",
						name: "Innate Spellcasting",
					},
					{
						value: "pact",
						name: "Pact Magic",
					},
				],
			},
			isSpellPoints: {
				name: `Use Spell Points`,
				help: `If enabled, imported spells which would use spell slots will instead be marked as "at will" and set to consume an actor's primary/secondary/tertiary resource. (The "Spell Points" variant rule can be found in the DMG, page 288.)`,
				default: false,
				type: "boolean",
				isPlayerEditable: true,
			},
			spellPointsResource: {
				name: "Spell Points Resource",
				help: `The resource consumed by spells imported with "Use Spell Points" enabled.`,
				default: "resources.primary.value",
				type: "enum",
				values: [
					{
						value: "resources.primary.value",
					},
					{
						value: "resources.secondary.value",
					},
					{
						value: "resources.tertiary.value",
					},
				],
				isPlayerEditable: true,
			},
			isMetric: {
				name: "Convert Spell Ranges to Metric",
				help: "Whether or not spell range/area units should be converted to an approximate metric equivalent (5 feet \u2248 1.5 metres; 1 mile \u2248 1.6 kilometres).",
				default: false,
				type: "boolean",
			},
		},
		settingsAdvanced: {
			additionalDataCompendium: {
				name: "Additional Data Compendiums",
				help: `A comma-separated list of compendiums that the spell importer will attempt to pull additional data (including art) from rather than use the default Plutonium icons.`,
				default: ConfigConsts.SRD_COMPENDIUMS_SPELLS.join(", "),
				type: "string",
				isNullable: true,
			},
			isImportDescription: {
				name: "Import Text as Description",
				help: `If enabled, a spell's text will be imported as item description.`,
				default: true,
				type: "boolean",
			},
		},
	},
	importRule: {
		name: "Import (Rules)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported rule.`),
		},
	},
	importOptionalFeature: {
		name: "Import (Options & Features)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported option/feature.`),
		},
		settingsAdvanced: {
			additionalDataCompendium: {
				name: "Additional Data Compendiums",
				help: `A comma-separated list of compendiums that the optional feature importer will attempt to pull additional data (including art) from rather than use the default Plutonium icons.`,
				default: ConfigConsts.SRD_COMPENDIUMS_OPTIONAL_FEATURES.join(", "),
				type: "string",
				isNullable: true,
			},
			isImportDescription: {
				name: "Import Text as Description",
				help: `If enabled, an optional feature's text will be imported as item description.`,
				default: true,
				type: "boolean",
			},
		},
	},
	importConditionDisease: {
		name: "Import (Conditions & Diseases)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported condition/diseases.`),
		},
		settingsAdvanced: {
			isImportDescription: {
				name: "Import Text as Description",
				help: `If enabled, a condition/disease's text will be imported as item description.`,
				default: true,
				type: "boolean",
			},
		},
	},
	importReward: {
		name: "Import (Gifts & Rewards)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported supernatural gift/reward.`),
		},
		settingsAdvanced: {
			isImportDescription: {
				name: "Import Text as Description",
				help: `If enabled, a supernatural gift/reward's text will be imported as item description.`,
				default: true,
				type: "boolean",
			},
		},
	},
	importDeity: {
		name: "Import (Deities)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported deity.`),
		},
	},
	importRecipe: {
		name: "Import (Recipes)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported recipe.`),
		},
	},
	importAdventure: {
		name: "Import (Adventures)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported adventure.`),
			isOrderingPrefixJournalNames: {
				name: "Add Sort Order Prefix to Journal Entry Names",
				help: `If imported journal entries should be prefixed with a sorting-friendly identifier, to avoid directory sorting from re-ordering them.`,
				type: "boolean",
				default: false,
			},
			isUseModdedInstaller: {
				name: "Use Modded Package Installer",
				help: `If the modded Plutonium backend is installed, adventure packages (modules/worlds) will be installed, automatically, using the mod, rather than providing you with a list of links to copy-paste into Foundry's "Setup".`,
				type: "boolean",
				default: false,
				unlockCode: "unlock",
			},
			isUseLegacyImporter: {
				name: "Enable Legacy Package Importer",
				help: `If Plutonium should allow adventure packages (modules/worlds) to be imported directly, rather than providing references for the user to investigate themselves.`,
				type: "boolean",
				default: false,
				unlockCode: "unlock",
			},
			indexUrl: {
				name: "Package Index URL",
				help: `The URL of the index file from which world/module package metadata is loaded.`,
				type: "string",
				// Previously/alternate link: `https://foundry.5e.tools/plutonium/index.json`
				default: "https://raw.githubusercontent.com/DMsGuild201/Foundry_Resources/master/worlds/index.json",
				isReloadRequired: true,
			},
		},
	},
	importBook: {
		name: "Import (Books)",
		settings: {
			permissions: ConfigConsts._template_getEntityPermissions(`The default (i.e. used for all players unless a player-specific permission level is set) permissions for an imported book.`),
			isOrderingPrefixJournalNames: {
				name: "Add Sort Order Prefix to Journal Entry Names",
				help: `If imported journal entries should be prefixed with a sorting-friendly identifier, to avoid directory sorting from re-ordering them.`,
				type: "boolean",
				default: false,
			},
		},
	},
	actor: {
		name: "Actors",
		settingsHacks: {
			isAutoMultiattack: {
				name: "Auto-Roll Multiattacks",
				help: `Attempt to detect and automatically roll components of a creature's "Multiattack" sheet item on activation.`,
				default: false,
				type: "boolean",
				compatibilityModeValues: {
					[UtilCompat.MODULE_MIDI_QOL]: false,
				},
			},
			isUseExtendedActiveEffectsParser: {
				name: "Support Variables in Active Effect Values",
				help: `Allows the use of roll syntax, and notably variables (such as "@abilities.dex.mod"), in active effect values.`,
				default: true,
				type: "boolean",
				compatibilityModeValues: {
					[UtilCompat.MODULE_DAE]: false,
				},
			},
		},
	},
	rivet: {
		name: "Rivet",
		settings: {
			targetActorId: {
				name: "Target Actor",
				help: `The ID of an actor to which Rivet content should be imported.`,
				default: "",
				type: "string",
				isPlayerEditable: true,
			},
		},
	},
	artBrowser: {
		name: "Art Browser",
		settings: {
			importImagesAs: {
				name: "Drag-Drop Images As",
				help: `The type of canvas object that should be created when drag-dropping images from the art browser to the canvas.`,
				default: 0,
				type: "enum",
				values: [
					{
						value: ConfigConsts.C_ART_IMAGE_MODE_TOKEN,
						name: "Tiles",
					},
					{
						value: ConfigConsts.C_ART_IMAGE_MODE_TILE,
						name: "Tokens",
					},
					{
						value: ConfigConsts.C_ART_IMAGE_MODE_NOTE,
						name: "Journal Notes",
					},
					{
						value: ConfigConsts.C_ART_IMAGE_MODE_SCENE,
						name: "Scenes",
					},
				],
			},
			scale: {
				name: "Tile/Scene Scaling",
				help: `A factor by which to scale placed tiles, and by which to scale scene backgrounds.`,
				default: 1.0,
				type: "number",
				min: 0.01,
				max: 100,
			},
			tokenSize: {
				name: "Token Size",
				help: `The default size of placed tokens.`,
				default: 1,
				type: "enum",
				values: [
					{
						value: 1,
						name: "Medium or smaller",
					},
					{
						value: 2,
						name: "Large",
					},
					{
						value: 3,
						name: "Huge",
					},
					{
						value: 4,
						name: "Gargantuan or larger",
					},
				],
			},
			isSwitchToCreatedScene: {
				name: "Activate Scenes on Creation",
				help: `If enabled, a scene will be activated upon creation (by drag-dropping an image to the canvas).`,
				default: true,
				type: "boolean",
			},
			isDisplaySheetCreatedScene: {
				name: "Display Scene Sheets on Creation",
				help: `If enabled, the "sheet" (i.e., configuration UI) for a scene will be shown upon creation (by drag-dropping an image to the canvas).`,
				default: true,
				type: "boolean",
			},
			artDirectoryPath: {
				name: "User Art Directory",
				help: `The sub-directory of the "User Data" directory where downloaded images and image packs will be saved.`,
				default: "assets/art",
				type: "string",
				isNullable: true,
			},
			buttonDisplay: {
				name: "Add Button To",
				help: `The place(s) where the Art Browser button should be visible.`,
				default: {
					[ConfigConsts.C_ART_IMAGE_MODE_TOKEN]: true,
					[ConfigConsts.C_ART_IMAGE_MODE_TILE]: true,
					[ConfigConsts.C_ART_IMAGE_MODE_NOTE]: true,
					[ConfigConsts.C_ART_IMAGE_MODE_SCENE]: true,
				},
				type: "multipleChoice",
				choices: [
					"Token scene controls",
					"Tile scene controls",
					"Note scene controls",
					"Scene controls",
				],
			},
		},
	},
	journalEntries: {
		name: "Journal Entries",
		settings: {
			isEnableUrlEmbeds: {
				name: "Enable URL Entries",
				help: `Add a "Set URL" context menu option to journal entry directory items, allowing the contents of the journal item to be replaced with embedded web content (Google Doc, reference page, YouTube video, etc.).`,
				default: false,
				type: "boolean",
				compatibilityModeValues: {
					[UtilCompat.MODULE_KANKA_FOUNDRY]: false,
				},
			},
			isEnableJournalEmbeds: {
				name: "Enable Journal Embeds",
				help: `Add custom syntax to journal entries, which allows other journal entries to be embedded. This syntax is similar to that used to link a journal entry; simply prepend "Embed" to a content link. For example, "@JournalEntry[Entry Name]" would become "@EmbedJournalEntry[Entry Name]".`,
				default: false,
				type: "boolean",
			},
			isAutoExpandJournalEmbeds: {
				name: "Auto-Expand Journal Embeds",
				help: `If the "Enable Journal Embeds" option is enabled, this determines whether or not the embedded content is expanded by default.`,
				default: true,
				type: "boolean",
			},
			isEnableContentLinks: {
				name: "Enable Content @tag Links",
				help: `Add custom syntax to journal entries, which enables an approximation of 5etools @tag syntax. This syntax is of the form "@<tagName>[<name|source|...>]". For example, "@creature[goblin]{goblins!}" could be used to insert the link "goblins!" which, when clicked, would load a (temporary) Goblin actor via the importer. For a complete list of available tags, see the 5etools Renderer Demo page (https://5e.tools/renderdemo.html).`,
				default: true,
				type: "boolean",
			},
		},
	},
	tools: {
		name: "Tools",
		settings: {
			isDeduplicateIgnoreType: {
				name: "Ignore Types When Deduplicating",
				help: `If enabled, the Collection Deduplicator will ignore entity types, treating e.g. a PC sheet and an NPC sheet with the same name as a set of duplicates.`,
				default: false,
				type: "boolean",
			},
		},
	},
	misc: {
		name: "Miscellaneous",
		settingsAdvanced: {
			isSkipBackendCheck: {
				name: "Skip Backend Check",
				help: `Avoid sending a network request during module initialisation to check if the modded Plutonium backend is installed.`,
				default: false,
				type: "boolean",
				isPlayerEditable: true,
			},
		},
	},
	equipmentShop: {
		name: "Equipment Shop",
		settings: {
			priceMultiplier: {
				name: "Price Multiplier",
				help: `A factor by which the prices in the equipment shop are multiplied.`,
				default: 1.0,
				type: "number",
				min: 0.0001,
			},
			minimumRole: {
				name: "Minimum Permission Level",
				help: `"Equipment Shop" button will be hidden for any user with a role less than the chosen role.`,
				default: CONST.USER_ROLES.NONE,
				type: "enum",
				values: [
					{
						value: CONST.USER_ROLES.NONE,
						name: `None`,
					},
					{
						value: CONST.USER_ROLES.PLAYER,
						name: `Player`,
					},
					{
						value: CONST.USER_ROLES.TRUSTED,
						name: `Trusted`,
					},
					{
						value: CONST.USER_ROLES.ASSISTANT,
						name: `Assistant`,
					},
					{
						value: CONST.USER_ROLES.GAMEMASTER,
						name: `Gamemaster`,
					},
				],
			},
		},
	},
};

export {ConfigConsts};
