#!/bin/bash

echo "🚀 Setting up NeoScan Physician App..."

# Check if Node.js is installed
if ! command -v node &> /dev/null; then
    echo "❌ Node.js is not installed. Please install Node.js >= 18 first."
    exit 1
fi

# Check Node.js version
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
if [ "$NODE_VERSION" -lt 18 ]; then
    echo "❌ Node.js version 18 or higher is required. Current version: $(node -v)"
    exit 1
fi

echo "✅ Node.js version: $(node -v)"

# Install dependencies
echo "📦 Installing dependencies..."
npm install

# iOS setup (macOS only)
if [[ "$OSTYPE" == "darwin"* ]]; then
    echo "🍎 Setting up iOS dependencies..."
    cd ios
    pod install
    cd ..
    echo "✅ iOS setup completed"
else
    echo "ℹ️  Skipping iOS setup (not on macOS)"
fi

echo "✅ Setup completed successfully!"
echo ""
echo "🎯 Next steps:"
echo "1. Start the development server: npm start"
echo "2. Run on Android: npm run android"
echo "3. Run on iOS (macOS only): npm run ios"
echo ""
echo "📱 The app will open with a login screen. Use any credentials to proceed to the dashboard." 