#!/bin/pwsh
. "$PSScriptRoot/Drivers.ps1";
. "$PSScriptRoot/../../../../../scripts/Common/Scripts/Context.ps1";
. "$PSScriptRoot/../../../../../scripts/Windows/Collections/Personal.ps1"
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Manage.ps1";

function Initialize-Configuration {
    # Fix synchronization between Linux and Windows clock
    Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name "RealTimeIsUniversal" -Value 1 -Type "DWord";

    # Force time resynchronization
    $service = Get-Service W32Time;
    $stopped = ($service.Status -eq "Stopped");
    Start-Service $service;
    w32tm /resync /force;

    if ($stopped) {
        Stop-Service $service;
    }
}

function Restore-Apps {
    param([Context] $context)
    Restore-PersonalApps $context;
}

Write-Host "Starting Restoration of Windows";
[Context]$context = [Context]::new();
Start-WindowsInstallation;