<?xml version="1.0"?>
<?define ProductVersion = "1.3.0"?>
<?define ProductUpgradeCode = "ba790d99-4d2c-4e33-a92d-219970637fca"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
   <Product Id="*" UpgradeCode="$(var.ProductUpgradeCode)" 
            Name="Bespoke Synth" Version="$(var.ProductVersion)" Manufacturer="Ryan Challinor" Language="1033">
      <Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package"/>
      <Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>
      <Icon Id="ProductIcon" SourceFile="..\ignore\build\Source\BespokeSynth_artefacts\JuceLibraryCode\icon.ico"/>
      <Property Id="ARPPRODUCTICON" Value="ProductIcon"/>
      <Property Id="ARPHELPLINK" Value="http://www.bespokesynth.com"/>
      <Property Id="ARPURLINFOABOUT" Value="http://www.bespokesynth.com"/>
      <Property Id="ARPNOREPAIR" Value="1"/>
      <Upgrade Id="$(var.ProductUpgradeCode)">
         <UpgradeVersion Minimum="$(var.ProductVersion)" OnlyDetect="yes" Property="NEWERVERSIONDETECTED"/>
         <UpgradeVersion Minimum="0.0.0" Maximum="$(var.ProductVersion)" IncludeMinimum="yes" IncludeMaximum="no" 
                         Property="OLDERVERSIONBEINGUPGRADED"/>	  
      </Upgrade>
      <Condition Message="A newer version of this software is already installed.">NOT NEWERVERSIONDETECTED</Condition>

      <Directory Id="TARGETDIR" Name="SourceDir">
         <Directory Id="ProgramFiles64Folder">
            <Directory Id="INSTALLDIR" Name="BespokeSynth">
               <Component Id="ApplicationFiles" Guid="0a2563f0-5f49-4ae8-acda-143a019f73a2">
                  <File Id="MainExecutable" Source="..\ignore\build\Source\BespokeSynth_artefacts\Release\BespokeSynth.exe"/>
                  <File Id="Readme" Source="readme.txt"/>
               </Component>
               <Directory Id="RESOURCE_DIR_REF" Name="resource">
               </Directory>
               <Directory Id="PYTHON_DIR_REF" Name="python">
               </Directory>
            </Directory>
         </Directory>

         <Directory Id="ProgramMenuFolder">
            <Directory Id="ProgramMenuSubfolder" Name="Bespoke Synth">
               <Component Id="ApplicationShortcuts" Guid="8f2ac8c2-b3bc-4d3c-8097-b62b5eed28ae">
                  <Shortcut Id="ApplicationShortcut1" Name="Bespoke Synth" Description="Bespoke Synth" 
                            Target="[INSTALLDIR]BespokeSynth.exe" WorkingDirectory="INSTALLDIR"/>
                  <RegistryValue Root="HKCU" Key="Software\Ryan Challinor\Bespoke Synth" 
                            Name="installed" Type="integer" Value="1" KeyPath="yes"/>
                  <RemoveFolder Id="ProgramMenuSubfolder" On="uninstall"/>
               </Component>
            </Directory>
         </Directory>
      </Directory>

      <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
      <UI>
         <UIRef Id="WixUI_InstallDir" />
         <Publish Dialog="WelcomeDlg"
               Control="Next"
               Event="NewDialog"
               Value="InstallDirDlg"
               Order="2">1</Publish>
         <Publish Dialog="InstallDirDlg"
               Control="Back"
               Event="NewDialog"
               Value="WelcomeDlg"
               Order="2">1</Publish>
      </UI>

      <InstallExecuteSequence>
         <RemoveExistingProducts After="InstallValidate"/>
      </InstallExecuteSequence>

      <Feature Id="DefaultFeature" Level="1">
         <ComponentRef Id="ApplicationFiles"/>
         <ComponentRef Id="ApplicationShortcuts"/>
         <ComponentGroupRef Id="BespokeResourceDir" />
         <ComponentGroupRef Id="BespokePythonDir" />
      </Feature>
   </Product>
</Wix>