#!/bin/bash

# BookingPro Quick Setup Script
# Run this after cloning from GitHub

echo "🚀 Setting up BookingPro locally..."

# 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

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

# Create .env from example if it doesn't exist
if [ ! -f .env ]; then
    echo "📝 Creating .env file from template..."
    cp .env.example .env
    echo "⚠️  Please edit .env with your database credentials"
else
    echo "✅ .env file already exists"
fi

echo ""
echo "🎉 Setup complete!"
echo ""
echo "Next steps:"
echo "1. Edit .env with your XAMPP MySQL credentials"
echo "2. Create 'bookingpro' database in phpMyAdmin"
echo "3. Import mysql-setup.sql via phpMyAdmin SQL tab"
echo "4. Run: npm run dev"
echo ""
echo "Access points:"
echo "- Application: http://localhost:5173"
echo "- Admin: http://localhost:5173/admin/login"
echo "- phpMyAdmin: http://localhost/phpmyadmin/"
echo ""
echo "Default admin: admin@bookingpro.com / admin123"