Dispatch sequence diagram

%%{init: { "theme": "base", "themeVariables": { "fontSize": "18px", "background": "transparent", "actorBkg": "#038851", "actorTextColor": "#ffffff", "actorBorder": "#026139", "actorLineColor": "#94a3b8", "signalColor": "#64748b", "signalTextColor": "#059669", "noteBkgColor": "#e6f4ee", "noteTextColor": "#02502f", "noteBorderColor": "#038851", "activationBkgColor": "#c6ebdc", "activationBorderColor": "#026139", "sequenceNumberColor": "#ffffff" }, "sequence": { "useMaxWidth": true, "actorMargin": 70, "width": 150, "height": 60, "boxMargin": 12, "noteMargin": 14, "messageMargin": 50, "diagramMarginX": 20, "diagramMarginY": 20, "actorFontSize": 18, "actorFontWeight": 700, "noteFontSize": 15, "noteFontFamily": "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace", "messageFontSize": 16, "messageFontWeight": 700, "noteAlign": "left", "mirrorActors": false } }}%%
sequenceDiagram
    participant PARORD as Ordering Platform
    participant Deliverect
    participant Dispatch as Dispatch Partner

    Note over PARORD,Dispatch: 1. Dispatch availability
    PARORD->>Deliverect: POST /fulfillment/validate
    Note right of PARORD: https://developers.deliverect.com/v3.0/reference/post_fulfillment-validate
    Deliverect->>Dispatch: Request delivery availability
    Dispatch-->>Deliverect: canDeliver: true | false
    Deliverect-->>PARORD: Availability response (canDeliver)

    Note over PARORD,Dispatch: 2. Create order (only if canDeliver: true)
    PARORD->>Deliverect: Create channel order
    Note right of PARORD: https://developers.deliverect.com/v3.0/reference/create-channel-order
    Deliverect->>Dispatch: Create dispatch / delivery job
    Dispatch-->>Deliverect: Order created confirmation
    Deliverect-->>PARORD: Delivery created (courier status update, status 81)

    Note over PARORD,Dispatch: 3. Courier status updates
    Dispatch->>Deliverect: Courier status (e.g. 83, 85, 87, 89, 90)
    Deliverect->>PARORD: Courier update webhook
    Note right of PARORD: https://developers.deliverect.com/v3.0/reference/courier-update-webhook