use std::collections::HashMap;
use std::sync::LazyLock;

/// Maps lowercase macro keywords (including `${...}` delimiters) to their
/// canonical casing as defined in the NSIS bundled include libraries.
///
/// Sources: FileFunc.nsh, LogicLib.nsh, Memento.nsh, StrFunc.nsh,
/// TextFunc.nsh, WinVer.nsh, WordFunc.nsh, x64.nsh
pub static CANONICAL_INCLUDES: LazyLock<HashMap<&'static str, &'static str>> =
	LazyLock::new(|| {
		HashMap::from([
			// FileFunc.nsh
			("${bannertrimpath}", "${BannerTrimPath}"),
			("${dirstate}", "${DirState}"),
			("${drivespace}", "${DriveSpace}"),
			("${getbasename}", "${GetBaseName}"),
			("${getdrives}", "${GetDrives}"),
			("${getexename}", "${GetExeName}"),
			("${getexepath}", "${GetExePath}"),
			("${getfileattributes}", "${GetFileAttributes}"),
			("${getfileext}", "${GetFileExt}"),
			("${getfilename}", "${GetFileName}"),
			("${getfileversion}", "${GetFileVersion}"),
			("${getoptions}", "${GetOptions}"),
			("${getoptionss}", "${GetOptionsS}"),
			("${getparameters}", "${GetParameters}"),
			("${getparent}", "${GetParent}"),
			("${getroot}", "${GetRoot}"),
			("${getsize}", "${GetSize}"),
			("${gettime}", "${GetTime}"),
			("${locate}", "${Locate}"),
			("${refreshshellicons}", "${RefreshShellIcons}"),
			// LogicLib.nsh
			("${andif}", "${AndIf}"),
			("${andifnot}", "${AndIfNot}"),
			("${andunless}", "${AndUnless}"),
			("${break}", "${Break}"),
			("${case}", "${Case}"),
			("${caseelse}", "${CaseElse}"),
			("${continue}", "${Continue}"),
			("${default}", "${Default}"),
			("${do}", "${Do}"),
			("${dountil}", "${DoUntil}"),
			("${dowhile}", "${DoWhile}"),
			("${else}", "${Else}"),
			("${elseif}", "${ElseIf}"),
			("${elseifnot}", "${ElseIfNot}"),
			("${elseunless}", "${ElseUnless}"),
			("${endif}", "${EndIf}"),
			("${endselect}", "${EndSelect}"),
			("${endswitch}", "${EndSwitch}"),
			("${exitdo}", "${ExitDo}"),
			("${exitfor}", "${ExitFor}"),
			("${exitwhile}", "${ExitWhile}"),
			("${for}", "${For}"),
			("${foreach}", "${ForEach}"),
			("${if}", "${If}"),
			("${ifcmd}", "${IfCmd}"),
			("${ifnot}", "${IfNot}"),
			("${ifnotthen}", "${IfNotThen}"),
			("${ifthen}", "${IfThen}"),
			("${loop}", "${Loop}"),
			("${loopuntil}", "${LoopUntil}"),
			("${loopwhile}", "${LoopWhile}"),
			("${orif}", "${OrIf}"),
			("${orifnot}", "${OrIfNot}"),
			("${orunless}", "${OrUnless}"),
			("${select}", "${Select}"),
			("${switch}", "${Switch}"),
			("${unless}", "${Unless}"),
			("${while}", "${While}"),
			// Memento.nsh
			("${mementosection}", "${MementoSection}"),
			("${mementosectiondone}", "${MementoSectionDone}"),
			("${mementosectionend}", "${MementoSectionEnd}"),
			("${mementosectionrestore}", "${MementoSectionRestore}"),
			("${mementosectionsave}", "${MementoSectionSave}"),
			("${mementounselectedsection}", "${MementoUnselectedSection}"),
			// StrFunc.nsh
			("${strcase}", "${StrCase}"),
			("${strclb}", "${StrClb}"),
			("${striotonsis}", "${StrIOToNSIS}"),
			("${strloc}", "${StrLoc}"),
			("${strnsistoio}", "${StrNSISToIO}"),
			("${strrep}", "${StrRep}"),
			("${strsort}", "${StrSort}"),
			("${strstr}", "${StrStr}"),
			("${strstradv}", "${StrStrAdv}"),
			("${strtok}", "${StrTok}"),
			("${strtrimnewlines}", "${StrTrimNewLines}"),
			// TextFunc.nsh
			("${configread}", "${ConfigRead}"),
			("${configreads}", "${ConfigReadS}"),
			("${configwrite}", "${ConfigWrite}"),
			("${configwrites}", "${ConfigWriteS}"),
			("${filejoin}", "${FileJoin}"),
			("${filereadfromend}", "${FileReadFromEnd}"),
			("${filerecode}", "${FileRecode}"),
			("${linefind}", "${LineFind}"),
			("${lineread}", "${LineRead}"),
			("${linesum}", "${LineSum}"),
			("${textcompare}", "${TextCompare}"),
			("${textcompares}", "${TextCompareS}"),
			("${trimnewlines}", "${TrimNewLines}"),
			// WinVer.nsh
			("${atleastservicepack}", "${AtLeastServicePack}"),
			("${atleastwin10}", "${AtLeastWin10}"),
			("${atleastwin11}", "${AtLeastWin11}"),
			("${atleastwin2000}", "${AtLeastWin2000}"),
			("${atleastwin2003}", "${AtLeastWin2003}"),
			("${atleastwin2008}", "${AtLeastWin2008}"),
			("${atleastwin2008r2}", "${AtLeastWin2008R2}"),
			("${atleastwin7}", "${AtLeastWin7}"),
			("${atleastwin8}", "${AtLeastWin8}"),
			("${atleastwin8.1}", "${AtLeastWin8.1}"),
			("${atleastwin95}", "${AtLeastWin95}"),
			("${atleastwin98}", "${AtLeastWin98}"),
			("${atleastwinme}", "${AtLeastWinME}"),
			("${atleastwinnt4}", "${AtLeastWinNT4}"),
			("${atleastwinvista}", "${AtLeastWinVista}"),
			("${atleastwinxp}", "${AtLeastWinXP}"),
			("${atmostservicepack}", "${AtMostServicePack}"),
			("${atmostwin10}", "${AtMostWin10}"),
			("${atmostwin11}", "${AtMostWin11}"),
			("${atmostwin2000}", "${AtMostWin2000}"),
			("${atmostwin2003}", "${AtMostWin2003}"),
			("${atmostwin2008}", "${AtMostWin2008}"),
			("${atmostwin2008r2}", "${AtMostWin2008R2}"),
			("${atmostwin2012}", "${AtMostWin2012}"),
			("${atmostwin2012r2}", "${AtMostWin2012R2}"),
			("${atmostwin7}", "${AtMostWin7}"),
			("${atmostwin8}", "${AtMostWin8}"),
			("${atmostwin8.1}", "${AtMostWin8.1}"),
			("${atmostwin95}", "${AtMostWin95}"),
			("${atmostwin98}", "${AtMostWin98}"),
			("${atmostwinme}", "${AtMostWinME}"),
			("${atmostwinnt4}", "${AtMostWinNT4}"),
			("${atmostwinvista}", "${AtMostWinVista}"),
			("${atmostwinxp}", "${AtMostWinXP}"),
			("${isdomaincontroller}", "${IsDomainController}"),
			("${isnt}", "${IsNT}"),
			("${isserveros}", "${IsServerOS}"),
			("${isservicepack}", "${IsServicePack}"),
			("${iswin10}", "${IsWin10}"),
			("${iswin11}", "${IsWin11}"),
			("${iswin2000}", "${IsWin2000}"),
			("${iswin2003}", "${IsWin2003}"),
			("${iswin2008}", "${IsWin2008}"),
			("${iswin2008r2}", "${IsWin2008R2}"),
			("${iswin2012}", "${IsWin2012}"),
			("${iswin2012r2}", "${IsWin2012R2}"),
			("${iswin7}", "${IsWin7}"),
			("${iswin8}", "${IsWin8}"),
			("${iswin8.1}", "${IsWin8.1}"),
			("${iswin95}", "${IsWin95}"),
			("${iswin98}", "${IsWin98}"),
			("${iswinme}", "${IsWinME}"),
			("${iswinnt4}", "${IsWinNT4}"),
			("${iswinvista}", "${IsWinVista}"),
			("${iswinxp}", "${IsWinXP}"),
			// WordFunc.nsh
			("${strfilter}", "${StrFilter}"),
			("${strfilters}", "${StrFilterS}"),
			("${versioncompare}", "${VersionCompare}"),
			("${versionconvert}", "${VersionConvert}"),
			("${wordadd}", "${WordAdd}"),
			("${wordadds}", "${WordAddS}"),
			("${wordfind}", "${WordFind}"),
			("${wordfind2x}", "${WordFind2X}"),
			("${wordfind2xs}", "${WordFind2XS}"),
			("${wordfind3x}", "${WordFind3X}"),
			("${wordfind3xs}", "${WordFind3XS}"),
			("${wordfinds}", "${WordFindS}"),
			("${wordinsert}", "${WordInsert}"),
			("${wordinserts}", "${WordInsertS}"),
			("${wordreplace}", "${WordReplace}"),
			("${wordreplaces}", "${WordReplaceS}"),
			// x64.nsh
			("${disablex64fsredirection}", "${DisableX64FSRedirection}"),
			("${enablex64fsredirection}", "${EnableX64FSRedirection}"),
			("${iswow64}", "${IsWow64}"),
			("${runningx64}", "${RunningX64}"),
		])
	});
