# Axis Puls — Live Shift Management & Shift Arranger Demo

> Source: https://axispuls.ir/demo/
> OpenAPI 3.1 Spec: https://axispuls.ir/api/demo/openapi.json
> Plugin Manifest: https://axispuls.ir/api/demo/ai-plugin.json
> No login, phone number, OTP, or signup required. Runs in an isolated per-session RAM database (`sqlite:///:memory:`).

## Supported URLs & Languages
- Persian (default): `https://axispuls.ir/demo/`
- English: `https://axispuls.ir/demo/?lang=en`
- Arabic: `https://axispuls.ir/demo/?lang=ar`
- German (Deutsch): `https://axispuls.ir/demo/?lang=de`
- JSON Discovery Endpoint: `GET /api/demo/guide`
- OpenAPI 3.1 Tool Spec: `GET /api/demo/openapi.json`

## Fixed Demo Schedule & Rules
- **3 Fixed Shifts**: Morning (`08:00-14:00`, 6h), Evening (`14:00-20:00`, 6h), Night (`20:00-08:00`, 12h)
- **Active Standard Constraints**: No Morning after Night, >=12h rest between shifts, max 2 consecutive shifts, max 18h/day, max 200h/month, randomly generated 100-200h pending proposals per simulated staff member.
- Rule mutations and Shift Arranger internals stay locked on the server.

## One-Shot API Quick Test (Recommended for AI Assistants & Web Readers)
- **Read-Only Web Browsers (`GET`, zero auth, zero leftover RAM)**: `https://axispuls.ir/api/demo/quick-test?lang=en` (`en|fa|de|ar`)
- **JSON API Callers (`POST`)**:
```bash
curl -s -X POST https://axispuls.ir/api/demo/quick-test \
  -H "Content-Type: application/json" \
  -d '{"lang":"en","apply":true}'
```
Returns verified before/after summary (`below_min_before`, `below_min_after`, `reached_min_after`, `approved`), checked labor constraints (`min_rest_hours: 12`, `conflicts_detected: 0`), and sample placements (without revealing internal solver weights/logic). Use `POST` + `X-Demo-Session: <session_id>` if you want to inspect `/api/demo/session/info`.

## Interactive UI Testing (Playwright / AI Browser Agents)
1. Open `/demo/` (or `/demo/?lang=en`, `/demo/?lang=de`, `/demo/?lang=ar`).
2. Optionally choose `[data-testid="demo-preset-45"]`, `[data-testid="demo-preset-100"]`, or `[data-testid="demo-preset-200"]`, edit `[data-testid="demo-dept-name"]`, or add roles with `[data-testid="demo-add-role-btn"]`.
3. Click `[data-testid="demo-start-btn"]` to enter the Shift Management workspace inside `#dm-iframe`.
4. Inside `#dm-iframe`, switch views using `[data-testid="demo-tab-proposals"]`, `[data-testid="demo-tab-personnel"]`, `[data-testid="demo-tab-shifts"]`, `[data-testid="demo-tab-schedule"]`, or click `[data-testid="demo-run-arranger"]` to execute Shift Arranger and apply results to the monthly table.
5. Click `[data-testid="demo-home-link"]` to return to `/`, or `[data-testid="demo-exit-btn"]` to clear the demo session and return to the demo setup page.

## Direct Multi-Step REST API Testing (No Cookies / No Auth)
1. `POST /api/demo/session/start` with `Content-Type: application/json` and `{"lang":"en"}` -> receives `data.session_id`, `data.dept_id`, and `data.target_month`.
2. Send `X-Demo-Session: <session_id>` on subsequent requests:
   - `GET /api/demo/session/info` — inspect headcount, role totals, and proposal/confirmed counts.
   - `POST /api/demo/shifts/departments/<dept_id>/arrange/simulate` with `{"month":"<target_month>"}` (or `{}` to use session month) -> returns `data.arrangement_id`, `data.steps`, `data.summary`.
   - `POST /api/demo/shifts/departments/<dept_id>/arrange` with `{"arrangement_id":"<arrangement_id>"}` -> saves arrangement draft (`data.id`).
   - `POST /api/demo/shifts/departments/<dept_id>/arrange/<arrangement_id>/apply` with `{}` -> applies saved draft.
   - `POST /api/demo/session/reset-proposals` — revert confirmed shifts back to pending proposals.
   - `POST /api/demo/session/destroy` — immediately wipe the session from RAM.
