#\!/bin/bash
# Validate Docker setup files

echo "Validating Docker Setup Files..."
echo "================================="
echo ""

ERRORS=0

# Check backend files
echo "Backend Files:"
if [ -f "backend/Dockerfile" ]; then
    echo "  ✓ backend/Dockerfile exists"
else
    echo "  ✗ backend/Dockerfile missing"
    ERRORS=$((ERRORS + 1))
fi

if [ -f "backend/.dockerignore" ]; then
    echo "  ✓ backend/.dockerignore exists"
else
    echo "  ✗ backend/.dockerignore missing"
    ERRORS=$((ERRORS + 1))
fi

echo ""

# Check frontend files
echo "Frontend Files:"
if [ -f "frontend/Dockerfile" ]; then
    echo "  ✓ frontend/Dockerfile exists"
else
    echo "  ✗ frontend/Dockerfile missing"
    ERRORS=$((ERRORS + 1))
fi

if [ -f "frontend/.dockerignore" ]; then
    echo "  ✓ frontend/.dockerignore exists"
else
    echo "  ✗ frontend/.dockerignore missing"
    ERRORS=$((ERRORS + 1))
fi

if [ -f "frontend/nginx.conf" ]; then
    echo "  ✓ frontend/nginx.conf exists"
else
    echo "  ✗ frontend/nginx.conf missing"
    ERRORS=$((ERRORS + 1))
fi

echo ""

# Check root files
echo "Root Files:"
if [ -f "docker-compose.yml" ]; then
    echo "  ✓ docker-compose.yml exists"
else
    echo "  ✗ docker-compose.yml missing"
    ERRORS=$((ERRORS + 1))
fi

if [ -f "docker-test.sh" ]; then
    echo "  ✓ docker-test.sh exists"
    if [ -x "docker-test.sh" ]; then
        echo "    ✓ docker-test.sh is executable"
    else
        echo "    ✗ docker-test.sh is not executable"
        ERRORS=$((ERRORS + 1))
    fi
else
    echo "  ✗ docker-test.sh missing"
    ERRORS=$((ERRORS + 1))
fi

echo ""
echo "================================="
if [ $ERRORS -eq 0 ]; then
    echo "✓ All Docker files present and valid\!"
    exit 0
else
    echo "✗ Found $ERRORS error(s)"
    exit 1
fi
