# DBAOps Sovereign™ — Install Dependencies
# Run from repository root

$ErrorActionPreference = "Stop"
Set-Location $PSScriptRoot\..

Write-Host "DBAOps Sovereign™ — Installing dependencies..." -ForegroundColor Cyan

# Root
if (Test-Path "package.json") {
    npm install
}

# API
if (Test-Path "src\api\package.json") {
    Write-Host "Installing API dependencies..." -ForegroundColor Gray
    Set-Location src\api
    npm install
    Set-Location $PSScriptRoot\.\..
}

# Web
if (Test-Path "src\web\package.json") {
    Write-Host "Installing Web dependencies..." -ForegroundColor Gray
    Set-Location src\web
    npm install
    Set-Location $PSScriptRoot\.\..
}

Write-Host "Install complete." -ForegroundColor Green
Write-Host "Next: .\scripts\run.ps1" -ForegroundColor Yellow
