# Santa Package Manager Check Script
# Generated: {{ timestamp }}
# Version: {{ version }}
# Source: {{ source_name }}
# Manager: {{ manager }}

$ErrorActionPreference = "Stop"

Write-Host "🎅 Santa Package Check - {{ source_name }}" -ForegroundColor Green
Write-Host "Generated: {{ timestamp }}" -ForegroundColor Gray
Write-Host "Manager: {{ manager }}" -ForegroundColor Gray
Write-Host ""

{% if manager == "scoop" %}
# Scoop package check
if (Get-Command scoop -ErrorAction SilentlyContinue) {
    Write-Host "📦 Checking Scoop packages..." -ForegroundColor Yellow
    & {{ check_command | powershell_escape }}
} else {
    Write-Host "⚠️  Scoop not found." -ForegroundColor Red
    exit 1
}

{% elif manager == "choco" or manager == "chocolatey" %}
# Chocolatey package check
if (Get-Command choco -ErrorAction SilentlyContinue) {
    Write-Host "📦 Checking Chocolatey packages..." -ForegroundColor Yellow
    & {{ check_command | powershell_escape }}
} else {
    Write-Host "⚠️  Chocolatey not found." -ForegroundColor Red
    exit 1
}

{% elif manager == "winget" %}
# Windows Package Manager check
if (Get-Command winget -ErrorAction SilentlyContinue) {
    Write-Host "📦 Checking packages with Windows Package Manager..." -ForegroundColor Yellow
    & {{ check_command | powershell_escape }}
} else {
    Write-Host "⚠️  Windows Package Manager (winget) not found." -ForegroundColor Red
    exit 1
}

{% elif manager == "npm" %}
# NPM package check
if (Get-Command npm -ErrorAction SilentlyContinue) {
    Write-Host "📦 Checking NPM packages..." -ForegroundColor Yellow
    & {{ check_command | powershell_escape }}
} else {
    Write-Host "⚠️  NPM not found." -ForegroundColor Red
    exit 1
}

{% elif manager == "pip" or manager == "pip3" %}
# Python pip package check
if (Get-Command {{ manager }} -ErrorAction SilentlyContinue) {
    Write-Host "📦 Checking Python packages with {{ manager }}..." -ForegroundColor Yellow
    & {{ check_command | powershell_escape }}
} else {
    Write-Host "⚠️  {{ manager }} not found." -ForegroundColor Red
    exit 1
}

{% elif manager == "cargo" %}
# Rust cargo package check
if (Get-Command cargo -ErrorAction SilentlyContinue) {
    Write-Host "📦 Checking Rust packages..." -ForegroundColor Yellow
    & {{ check_command | powershell_escape }}
} else {
    Write-Host "⚠️  Cargo not found." -ForegroundColor Red
    exit 1
}

{% elif manager == "go" %}
# Go package check
if (Get-Command go -ErrorAction SilentlyContinue) {
    Write-Host "📦 Checking Go packages..." -ForegroundColor Yellow
    & {{ check_command | powershell_escape }}
} else {
    Write-Host "⚠️  Go not found." -ForegroundColor Red
    exit 1
}

{% else %}
# Generic package manager check
if (Get-Command {{ manager }} -ErrorAction SilentlyContinue) {
    Write-Host "📦 Checking packages with {{ manager }}..." -ForegroundColor Yellow
    & {{ check_command | powershell_escape }}
} else {
    Write-Host "⚠️  {{ manager }} not found." -ForegroundColor Red
    exit 1
}
{% endif %}

Write-Host ""
Write-Host "Generated by Santa v{{ version }} - https://github.com/tylerbutler/santa" -ForegroundColor Gray