. "$PSScriptRoot/../../lib/AppAssociations.ps1";
. "$PSScriptRoot/../../lib/SoftwareManagement.ps1";
. "$PSScriptRoot/../../../lib/Software.ps1";

Start-SoftwareInstaller @args `
        -Installer {
        Install-ChocoPackage firefox;
    } `
    -Configurator {
        Write-Host "Making Firefox the default browser…";
        $progIdSuffix = "-308046B0AF4A39CB";
        $appName = "Firefox";

        $extensions = @(
            ".htm",
            ".html",
            ".svg",
            ".xht",
            ".xhtml"
        );

        $schemes = @(
            "http",
            "https"
        );

        foreach ($extension in $extensions) {
            Set-DefaultAppAssociation -Identifier $extension -ProgId "${appName}HTML$progIdSuffix" -ApplicationName $appName;
        }

        foreach ($scheme in $schemes) {
            Set-DefaultAppAssociation -Identifier $scheme -ProgId "${appName}URL$progIdSuffix" -ApplicationName $appName;
        }

        Remove-TaskbarItem "*Firefox*";
    };