<?xml version="1.0" encoding="UTF-8"?>
<!--
  AudioFiles MSI source. Consumed by build-msi-native.ps1 (windows-x86, native
  WiX toolset) and build-msi.sh (macOS/Linux fallback via msitools wixl).

  Tokens replaced at build time:
    @VERSION@   — semver from crates/audiofiles-app/Cargo.toml, with ".0" suffix
                  (WiX requires four-part version)
-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*"
             Name="AudioFiles"
             Language="1033"
             Version="@VERSION@"
             Manufacturer="Maxwell Johnson"
             UpgradeCode="8B4D5A2E-7F3C-4E1A-9D6B-2C8A4F5E7D9B">

        <Package InstallerVersion="200"
                 Compressed="yes"
                 InstallScope="perUser"
                 Description="AudioFiles @VERSION@"
                 Comments="Sample manager with content-addressed storage" />

        <MajorUpgrade DowngradeErrorMessage="A newer version is already installed." />
        <MediaTemplate EmbedCab="yes" />

        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="LocalAppDataFolder">
                <Directory Id="INSTALLFOLDER" Name="AudioFiles">
                    <Component Id="MainExecutable" Guid="*">
                        <File Id="AudioFilesExe"
                              Source="AudioFiles.exe"
                              KeyPath="yes" />
                    </Component>
                </Directory>
            </Directory>
            <Directory Id="ProgramMenuFolder">
                <Component Id="StartMenuShortcut" Guid="*">
                    <Shortcut Id="AudioFilesShortcut"
                              Name="AudioFiles"
                              Target="[INSTALLFOLDER]AudioFiles.exe"
                              WorkingDirectory="INSTALLFOLDER" />
                    <RegistryValue Root="HKCU"
                                   Key="Software\AudioFiles"
                                   Name="installed"
                                   Type="integer"
                                   Value="1"
                                   KeyPath="yes" />
                    <RemoveFolder Id="RemoveStartMenu" On="uninstall" />
                </Component>
            </Directory>
        </Directory>

        <Feature Id="Complete" Title="AudioFiles" Level="1">
            <ComponentRef Id="MainExecutable" />
            <ComponentRef Id="StartMenuShortcut" />
        </Feature>
    </Product>
</Wix>
