<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">

   <?include $(sys.CURRENTDIR)\Common.wxi?>

   <?define NewPlusAssetsFiles=?>
   <?define NewPlusAssetsFilesPath=$(var.BinDir)WinUI3Apps\Assets\NewPlus\?>
   <?define NewPlusTemplateFilesPath=$(var.BinDir)WinUI3Apps\Assets\NewPlus\Templates\?>
   <?define NewPlusTemplateSubFilesPath=$(var.BinDir)WinUI3Apps\Assets\NewPlus\Templates\Example folder\?>

   <Fragment>

      <!-- Assets -->
      <DirectoryRef Id="WinUI3AppsAssetsFolder">
         <Directory Id="NewPlusAssetsInstallFolder" Name="NewPlus" />
      </DirectoryRef>
      <DirectoryRef Id="NewPlusAssetsInstallFolder" FileSource="$(var.NewPlusAssetsFilesPath)">
         <!-- Generated by generateFileComponents.ps1 -->
         <!--NewPlusAssetsFiles_Component_Def-->
      </DirectoryRef>

      <ComponentGroup Id="NewPlusComponentGroup">
         <Component Id="RemoveNewPlusFolder" Guid="4189C789-56EB-409D-912E-3F4F3F4F1FFA" Directory="NewPlusAssetsInstallFolder">
            <RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
               <RegistryValue Type="string" Name="RemoveNewPlusFolder" Value="" KeyPath="yes" />
            </RegistryKey>
            <RemoveFolder Id="RemoveFolderNewPlusAssetsFolder" Directory="NewPlusAssetsInstallFolder" On="uninstall" />
         </Component>
      </ComponentGroup>

      
      <!-- Example templates -->
      <DirectoryRef Id="WinUI3AppsAssetsFolder">
         <Directory Id="NewPlusInstallFolder" Name="NewPlus">
            <Directory Id="NewPlusTemplatesInstallFolder" Name="Templates">
               <Directory Id="NewPlusTemplatesSubInstallFolder" Name="Example folder" />
            </Directory>
         </Directory>
      </DirectoryRef>
      <DirectoryRef Id="NewPlusTemplatesInstallFolder" FileSource="$(var.NewPlusTemplateFilesPath)">
         <Component Id="NewPlusTemplateFiles_Component" Guid="39264075-4B7F-40E3-A76F-21E68576D43E" Bitness="always64">
            <RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
               <RegistryValue Type="string" Name="NewPlusTemplateFiles_Component" Value="" KeyPath="yes" />
            </RegistryKey>
            <File Id="NewPlusTemplateFiles_File_1.md" Source="$(var.NewPlusTemplateFilesPath)Any files or folders placed in the template folder are available via New+.txt" />
         </Component>
      </DirectoryRef>
      <DirectoryRef Id="NewPlusTemplatesSubInstallFolder" FileSource="$(var.NewPlusTemplateSubFilesPath)">
         <Component Id="NewPlusTemplateSubFiles_Component" Guid="7618E61C-CCB8-492F-B284-E1AE2954AF0B" Bitness="always64">
            <RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
               <RegistryValue Type="string" Name="NewPlusTemplateSubFiles_Component" Value="" KeyPath="yes" />
            </RegistryKey>
            <File Id="NewPlusTemplateSubFiles_File_1.md" Source="$(var.NewPlusTemplateSubFilesPath)Example txt file.txt" />
            <File Id="NewPlusTemplateSubFiles_File_2.md" Source="$(var.NewPlusTemplateSubFilesPath)Another example txt file.txt" />
         </Component>
      </DirectoryRef>

      <ComponentGroup Id="NewPlusTemplatesComponentGroup">
         <Component Id="RemoveNewPlusTemplateFolder" Guid="3E9B15CA-A50C-42DA-977F-5E9914562FE7" Directory="NewPlusInstallFolder">
            <RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
               <RegistryValue Type="string" Name="RemoveNewPlusTemplateFolder" Value="" KeyPath="yes" />
            </RegistryKey>
            <RemoveFolder Id="RemoveFolderNewPlusInstallFolder" Directory="NewPlusInstallFolder" On="uninstall" />
            <RemoveFolder Id="RemoveFolderNewPlusTemplatesInstallFolder" Directory="NewPlusTemplatesInstallFolder" On="uninstall" />
            <RemoveFolder Id="RemoveFolderNewPlusTemplatesSubInstallFolder" Directory="NewPlusTemplatesSubInstallFolder" On="uninstall" />
         </Component>
         <ComponentRef Id="NewPlusTemplateFiles_Component" />
         <ComponentRef Id="NewPlusTemplateSubFiles_Component" />
      </ComponentGroup>

   </Fragment>
</Wix>
