Write-Host "Generating Prisma client for deployment..." -ForegroundColor Cyan

npx prisma generate
if ($LASTEXITCODE -ne 0) {
    exit $LASTEXITCODE
}

if (-not (Test-Path "lib/generated/prisma/index.js")) {
    Write-Host "Error: lib/generated/prisma/index.js was not created." -ForegroundColor Red
    exit 1
}

Write-Host ""
Write-Host "Prisma client generated successfully." -ForegroundColor Green
Write-Host ""
Write-Host "Commit these files before deploying:" -ForegroundColor Cyan
Write-Host "git add lib/generated/prisma"
Write-Host "git commit -m 'Add generated Prisma client'"
Write-Host "git push"
