# Feature: Mobile apps (platform clients)

## Purpose

Native Android and iOS MVP clients so **staff** can check in / complete assigned appointments and **customers** can book available slots. Thin HTTP clients over the Laravel Sanctum JSON API — business rules stay in domain Actions/Policies.

## Boundaries

- **Owns:** [`android/`](../../android/), [`ios/`](../../ios/) source trees and READMEs
- **Does not own:** Laravel domains, Jetstream web UI, push/offline/maps, App Store / Play release pipelines
- **Depends on (platform only):** Sanctum token auth (`POST /api/login`, `/api/logout`, `/api/me`)
- **Depends on (other domains):** Jobs API (appointments list, check-in, complete, available-slots, book)

## Roles (MVP)

| Role | Surfaces |
|------|----------|
| `staff` | Assigned appointments → GPS check-in → complete |
| `customer` | Own jobs → date → available slots → book |

Provider / superadmin apps are out of scope for v1.

## Auth

1. `POST /api/login` with `email`, `password`, `device_name`
2. Store returned Sanctum `token` (Android EncryptedSharedPreferences / iOS Keychain)
3. Send `Authorization: Bearer {token}` on subsequent calls
4. `POST /api/logout` revokes the current token

## Staff flow

1. `GET /api/job-appointments?from=&to=`
2. `POST /api/jobs/{job}/appointments/{appointment}/check-in` `{ latitude, longitude }`
3. `POST /api/jobs/{job}/appointments/{appointment}/complete`

## Customer flow

1. `GET /api/jobs`
2. `GET /api/jobs/{job}/available-slots?date=YYYY-MM-DD`
3. `POST /api/jobs/{job}/appointments` with chosen `starts_at`

## Local API base URL

- Android emulator → host: `http://10.0.2.2/api/` via `local.properties` `api.base.url`
- iOS simulator → host: `http://127.0.0.1/api/` in `Config.swift`
- Physical devices → LAN IP of the Sail/Laravel host; cleartext HTTP allowed only for local MVP

## Tests

Laravel Feature tests cover login/slots/complete (see `tests/Feature/Api/AuthTest.php`, `tests/Feature/Domains/Jobs/JobAvailableSlotsAndCompleteApiTest.php`). Native UI is manual / Studio-Xcode run.

## Add / remove checklist

### Add

- [x] `android/` + `ios/` scaffolds
- [x] This wiki page linked from `docs/README.md`
- [x] Root README pointers

### Remove

- [ ] Delete `android/` and `ios/`
- [ ] Unlink this page and root README pointers
- [ ] Laravel API auth/slots/complete can remain for other clients
