# DockPlanner – API contract (voor front‑end koppeling)

## Auth
- Vervoerders loggen in via bestaande transportplanningstool (JWT/Cookie).

## Publieke slots
`GET /api/public-slots?date=YYYY-MM-DD&direction=inbound|outbound`
```json
[
  { "start": "2025-10-21T06:00:00+02:00", "capacity": 3, "used": 1, "free": 2 },
  { "start": "2025-10-21T06:30:00+02:00", "capacity": 3, "used": 3, "free": 0 }
]
```

## Boeken
`POST /api/bookings`
```json
{ "direction":"inbound","pallets":18,"start":"2025-10-21T09:30:00+02:00","duration":60,"notes":"ADR" }
```
**Server**:
- Valideer op boekingshorizon / min notice per vervoerder.
- Bereken `end = start + duration` (via `slot_duration_rules`).
- Check capaciteit in beide opeenvolgende blokken bij 60 min.
- Genereer `reference` met trigger (U/L suffix).

**Response**:
```json
{ "id":123, "reference":"VLS00012U", "start":"...", "end":"..." }
```

## Check‑in (aanmelding chauffeur)
`GET /api/bookings/by-ref/{reference}` → boeking basisgegevens  
`POST /api/arrivals/assign` body: `{ "bookingId":123 }`  
Server kiest **beste dock** op actuele situatie (zie algoritme).

## Admin – publieke capaciteit
`GET/POST /api/public-capacity/{date}` payload: `{ inbound:int, outbound:int }`

## Admin – docks
- CRUD `/api/docks` (code, naam, volgorde, inbound/outbound toelaatbaar, overflow, actief)
- `POST /api/docks/close` payload: `{ dockId, from, to, reason }` → herplan

## Admin – voorkeuren
`POST /api/carriers/{id}/preferred-docks` payload: `{ dockIds: [1,2] }`
