# LearnMe Installer
$ErrorActionPreference = "Stop"

$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$certFile  = Join-Path $scriptDir "learnme_cert.cer"
$msixFile  = Join-Path $scriptDir "learnme.msix"

Write-Host "Installing LearnMe..." -ForegroundColor Cyan

# Install certificate to Trusted People (requires admin)
Write-Host "Trusting publisher certificate..."
Import-Certificate -FilePath $certFile -CertStoreLocation Cert:\LocalMachine\TrustedPeople | Out-Null
Write-Host "Certificate trusted." -ForegroundColor Green

# Install the MSIX
Write-Host "Installing app..."
Add-AppxPackage -Path $msixFile
Write-Host ""
Write-Host "LearnMe installed successfully!" -ForegroundColor Green
Write-Host "You can find it in the Start menu." -ForegroundColor Green
Start-Sleep -Seconds 2
