#!/bin/bash
# Verify deployment files are present before deployment

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
DEPLOY_SOURCE="$PROJECT_ROOT/smom-dbis-138-proxmox"

echo "Checking deployment files..."
echo ""

REQUIRED_FILES=(
    "scripts/deployment/deploy-all.sh"
    "scripts/deployment/deploy-besu-nodes.sh"
    "scripts/deployment/deploy-services.sh"
    "install/besu-validator-install.sh"
    "install/besu-sentry-install.sh"
    "config/proxmox.conf"
)

MISSING=0

for file in "${REQUIRED_FILES[@]}"; do
    if [ -f "$DEPLOY_SOURCE/$file" ]; then
        echo "✅ $file"
    else
        echo "❌ $file (missing)"
        ((MISSING++))
    fi
done

echo ""
if [ $MISSING -eq 0 ]; then
    echo "✅ All required files present"
    exit 0
else
    echo "❌ $MISSING file(s) missing"
    exit 1
fi

