# Arkwright 2.0 ↔ Fusion API Integration (v2)

This package is compatible with the **path-router** API in `api.nexttheme.co.uk` (routes.php).

## Install
1. Copy `modules/FusionModule.php` into your Arkwright 2.0 modules folder.
2. Copy `config/fusion.php` into your Arkwright 2.0 config folder.
3. Import `sql/capabilities.sql` into your Arkwright database.
4. Ensure your Arkwright `action_router.php` can instantiate `FusionModule` and call:
   - `handle($actionName, $paramsArray)`

## Safety
- `FUSION_READ_ONLY` defaults to `true`. Keep it true until you have tested read endpoints.
- Write endpoints are blocked when read-only is enabled.

## Auth
- Fusion currently appears mostly unauthenticated at the controller level.
- If/when you enforce auth, set:
  - `FUSION_USE_SESSION_AUTH=true`
  - `FUSION_AUTH_EMAIL` / `FUSION_AUTH_PASSWORD`
The module will POST `/auth/login` once and keep the session cookie in a cookie jar.

## Example actions
- `fusion.client.list` → GET `/clients`
- `fusion.client.get` with `{id:123}` → GET `/clients/123`
- `fusion.invoice.create` with invoice payload → POST `/invoices`
