# Liv Hospital International — Local Development Setup Guide

### 1. Prerequisites
- **PHP**: ^8.2 (with `pdo_sqlite`, `pdo_mysql`, `curl`, `mbstring`, `openssl`, `bcmath`, `fileinfo`)
- **Composer**: ^2.x
- **Node.js**: ^18.x or ^20.x+ (tested on Node v26)
- **NPM**: ^10.x+
- **Flutter SDK**: Optional for driver mobile application development (path: `C:\flutter`)

---

### 2. Quickstart Installation

```bash
# 1. Clone or navigate to the repository
cd C:\Users\khruk\Desktop\livHospital

# 2. Environment Configuration
cp .env.example .env
php artisan key:generate

# 3. Database Initialization (SQLite default)
# Note: database/database.sqlite is used by default.
# For MySQL: set DB_CONNECTION=mysql in .env and configure credentials.
php artisan migrate

# 4. Frontend Compilation
npm install
npm run build

# 5. Start Development Server
php artisan serve
```

The application will be accessible at:
- **Application Web**: `http://localhost:8000`
- **Health Check Endpoint**: `http://localhost:8000/health`

---

### 3. Background Services & Queue Workers
For asynchronous notifications and event outbox processing:

```bash
# Run queue worker in development
php artisan queue:work --tries=3 --timeout=60

# Run Laravel scheduler (executes every minute in production)
php artisan schedule:work
```

---

### 4. Integration & Sandbox Mode
By default, the platform runs in `INTEGRATION_MODE=sandbox`:
- **WhatsApp**: Dispatches to `MockWhatsAppGateway`, logging message payloads in `storage/logs/laravel.log` and the database outbox without sending real network SMS/WhatsApp messages.
- **Maps**: Uses `OsmRoutingService` with OpenStreetMap / Haversine distance heuristics without external paid API keys.
- **Flight Data**: Uses `MockFlightTrackingService` supporting mock flight numbers (e.g. `TK1982`, `PC2014`, `EK121`). Append `D` to simulate a delayed flight (e.g. `TK1982D`).

To activate live providers, update `.env`:
```ini
INTEGRATION_MODE=live
WHATSAPP_DRIVER=cloud_api
WHATSAPP_API_TOKEN=<token>
WHATSAPP_PHONE_NUMBER_ID=<id>
```
