using namespace Microsoft.Win32;

param(
    $Action,
    [hashtable] $Arguments
)

. "$PSScriptRoot/../../Scripts/AppAssociations.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";

Start-SoftwareInstaller @PSBoundParameters `
    -Installer {
        param(
            [scriptblock] $Installer
        )

        Install-ChocoPackage thunderbird -ArgumentList "--params",'"/NoTaskbarShortcut /NoDesktopShortcut"'
        & $Installer -Action ([InstallerAction]::Configure)
    } `
    -Configurator {
        Write-Host "Making Thunderbird the default mail program…";
        $applicationName = "Thunderbird";
        Set-DefaultAppAssociation -Identifier "mailto" -ProgId "Thunderbird.Url.mailto" -ApplicationName $applicationName;
        Set-DefaultAppAssociation -Identifier ".eml" -ProgId "ThunderbirdEml" -ApplicationName $applicationName;
    };