# Mobile Endpoint Map

Every relevant mobile capability, its API route, and the controller/service behind it. The
`/api/*.md` files (e.g. `api/accept-order-by-restaurant.md`) are this repo's existing mobile API
documentation — the request/response shape the mobile app expects lives there.

## Order queue

| Capability | Route | Controller → Service |
|---|---|---|
| List a restaurant's orders | `GET /v1/orders/restaurant/{restaurant}` | `OrderController::getRestaurantOrders` → `OrderService::fetchRestaurantOrders` |
| View one order | `GET /v1/orders/{order}` | `OrderController::show` → `OrderService::getOrder` |
| Accept an order | `POST /v1/orders/{order}/accept` (`api/accept-order-by-restaurant.md`) | `OrderController::orderAcceptAction` → `OrderStatusService::accept`, gated by `OrderPolicy::accept` |
| Decline an order | `POST /v1/orders/{order}/decline` (`api/decline-order-by-restaurant.md`) | `OrderController::orderDeclineAction` → `OrderStatusService::decline`, gated by `OrderPolicy::decline` |
| Fees / status list | `GET /v1/order/fees`, `GET /v1/orders/statuses` | `OrderController::getFees`/`statuses` → `OrderService::getCalculationFees` |

## Dispatch

| Capability | Route | Controller → Service |
|---|---|---|
| List drivers eligible for manual assignment | `GET /v1/orders/{order}/available-drivers` (`api/get-available-drivers-for-assigning-to-order.md`) | `OrderController::availableDrivers` → `DispatchService::eligibleDrivers`, gated by `OrderPolicy::viewAvailableDrivers` |
| Manually offer to a driver | `POST /v1/orders/{order}/offer-driver/{driver}` (`api/assign-driver-manualy.md`) | `OrderController::offerDriver` → `DispatchService::offerToDriver`, gated by `OrderPolicy::offerDriver` |
| FCFS offers, claims, expiry | *(push-only — no GET, see `OrderDispatchUpdated` in [02](02-broadcast-reference.md))* | `DispatchService::open`/`claim`/`offerToDriver`/`rejectOffer` |
| Orders needing manual assignment | *(the `requires_manual_driver_assignment` column)* | — |

## Live delivery tracking

| Capability | Route | Controller → Service |
|---|---|---|
| Driver position while en route | *(push-only, `order.{id}` channel)* | `DriverProximityService::evaluate` → `DriverLocationUpdated` |
| Order status changes live | *(same channel)* | `OrderStatusUpdated` |

## Chat

| Capability | Route | Controller → Service |
|---|---|---|
| List an order's threads | `GET /v1/orders/{order}/conversations` | `ConversationController::index` → `ConversationService::getOrderConversations`, gated by `OrderPolicy::chat` |
| Open a thread | `GET /v1/conversations/{conversation}` | `ConversationController::show` → `ConversationService::getConversation`, gated by `ConversationPolicy::view` |
| Message history | `GET /v1/conversations/{conversation}/messages` | `ConversationController::messages` → `ConversationService::getMessages` (30/page, newest first) |
| Send a message | `POST /v1/conversations/{conversation}/messages` (throttled 60/min) | `ConversationController::store` → `ConversationService::sendMessage`, gated by `ConversationPolicy::sendMessage` |
| Mark a thread read | `POST /v1/conversations/{conversation}/read` | `ConversationController::markAsRead` → `ConversationService::markAsRead` |
| Live message arrival | *(push-only, `conversation.{id}` channel)* | `MessageSentEvent` — dispatched with `->toOthers()`, so the sender's own connection doesn't receive its own message back |
| View an attachment | `GET /v1/conversations/{conversation}/messages/{message}/attachment` (signed URL) | `ConversationController::attachment` — private disk, no public URL |

## Driver management (restaurant-owned fleet)

| Capability | Route | Controller → Service |
|---|---|---|
| List this restaurant's drivers | `GET /v1/drivers` | `DriverController::index` → `DriverService::getRestaurantDrivers` |
| Approve/refuse a driver submission | `PATCH /v1/drivers/{driver}/status` | `DriverController::update` → `DriverService::driverStatus` |
| Remove a driver | `DELETE /v1/drivers/{driver}` | `DriverController::destroy` → `DriverService::deleteDriver` |

## Restaurant profile & storefront

Mostly already has an admin-panel equivalent under `app/Livewire/Pages/Restaurant/*` /
`Setting/*` — check there first. The services behind self-service versions of these: `RestaurantService`
(profile, opening hours, availability, gallery), `ThemeService`, `SettingsService` (pricing/dispatch/timeouts),
`SliderService`, `RestaurantUserService` (staff — see the role-assignment note in
[06-tenancy-permissions-policies.md](06-tenancy-permissions-policies.md)).
