#!/bin/pwsh
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";

$null = New-Module {
    $path = "$HOME/Documents/ManiaPlanet";
    $softwareName = "ManiaPlanet";

    function Backup-ManiaPlanet([Context] $context) {
        Write-Information "Backing up ManiaPlanet";
        $context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
    }

    function Restore-ManiaPlanet([Context] $context) {
        Write-Host "Restoring ManiaPlanet";
        Write-Information "Installing ManiaPlanet";
        winget install --accept-source-agreements --accept-package-agreements -e --id Nadeo.ManiaPlanet;
        Write-Information "Restoring files";
        $context.Restore($context.SoftwareArchive($softwareName), $path);
    }
}