#!/bin/sh
#
# Pre-push hook: Full test suite before pushing
# Installed by cargo-husky
#

set -e

echo "🚀 Running pre-push checks..."
echo ""

# Run all tests
echo "🧪 Running tests..."
cargo test --all-features
if [ $? -ne 0 ]; then
    echo ""
    echo "❌ Tests failed!"
    echo "   Fix failing tests before pushing."
    exit 1
fi
echo "✅ Tests passed"
echo ""

# Run clippy one more time (in case of any changes)
echo "📎 Running clippy..."
cargo clippy --all-targets --all-features -- -D warnings
if [ $? -ne 0 ]; then
    echo ""
    echo "❌ Clippy found issues!"
    exit 1
fi
echo "✅ Clippy OK"
echo ""

# Check documentation builds
echo "📚 Checking documentation..."
cargo doc --no-deps --all-features 2>&1 | grep -i "warning\|error" && {
    echo ""
    echo "⚠️  Documentation warnings detected"
    # Don't fail on doc warnings, just notify
}
echo "✅ Documentation OK"
echo ""

echo "✅ All pre-push checks passed! Ready to push."

