{
 "$schema": "../../lib/umlimator.schema.json",
 "schemaVersion": 2,
 "title": "Timing diagram",
 "root": "checkout",
 "nodes": [
  { "id": "worker", "type": "uml.Lifeline", "label": "worker", "props": { "represents": "OrderWorker", "states": ["Idle", "Waiting for payment", "Recording payment"] } },
  { "id": "payments", "type": "uml.Lifeline", "label": "payments", "props": { "represents": "CardGateway", "states": ["Idle", "Authorising", "Capturing"] } },
  { "id": "order", "type": "uml.Lifeline", "label": "order1042", "props": { "represents": "Order" } },
  { "id": "mailer", "type": "uml.Lifeline", "label": "mailer", "props": { "represents": "Mailer", "states": ["Idle", "Sending"] } }
 ],
 "edges": [],
 "views": [
  { "id": "checkout", "diagram": "uml.timing", "title": "Paying for one bookshop order", "parent": null,
   "nodeIds": ["worker", "payments", "mailer", "order"],
   "present": { "order": { "as": "values" } },
   "edges": [
    { "id": "m-charge", "type": "uml.Message", "from": "worker", "to": "payments", "label": "charge(total)", "props": { "sort": "call", "sentAt": 100, "receivedAt": 140 } },
    { "id": "m-paid", "type": "uml.Message", "from": "payments", "to": "worker", "label": "paid", "props": { "sort": "reply", "replyTo": "m-charge", "sentAt": 720, "receivedAt": 760 } },
    { "id": "m-receipt", "type": "uml.Message", "from": "worker", "to": "mailer", "label": "receipt", "props": { "sort": "async", "stereotypes": ["signal"], "sentAt": 900, "receivedAt": 960 } }
   ],
   "timeline": { "unit": "ms",
    "changes": [
     { "id": "w-idle", "lifeline": "worker", "at": 0, "state": "Idle" },
     { "id": "w-waiting", "lifeline": "worker", "at": 100, "state": "Waiting for payment" },
     { "id": "w-recording", "lifeline": "worker", "at": 760, "state": "Recording payment" },
     { "id": "w-done", "lifeline": "worker", "at": 900, "state": "Idle" },
     { "id": "p-idle", "lifeline": "payments", "at": 0, "state": "Idle" },
     { "id": "p-authorising", "lifeline": "payments", "at": 140, "state": "Authorising" },
     { "id": "p-capturing", "lifeline": "payments", "at": 480, "state": "Capturing" },
     { "id": "p-done", "lifeline": "payments", "at": 720, "state": "Idle" },
     { "id": "o-placed", "lifeline": "order", "at": 0, "state": "placed" },
     { "id": "o-paying", "lifeline": "order", "at": 100, "state": "paying" },
     { "id": "o-paid", "lifeline": "order", "at": 760, "state": "paid" },
     { "id": "o-packing", "lifeline": "order", "at": 900, "state": "packing" },
     { "id": "e-idle", "lifeline": "mailer", "at": 0, "state": "Idle" },
     { "id": "e-sending", "lifeline": "mailer", "at": 960, "state": "Sending" },
     { "id": "e-done", "lifeline": "mailer", "at": 1180, "state": "Idle" }
    ],
    "constraints": [
     { "id": "c-capture", "type": "uml.DurationConstraint", "from": "p-capturing", "to": "p-done", "label": "{<= 300 ms}" },
     { "id": "c-wait", "type": "uml.DurationConstraint", "from": "w-waiting", "to": "p-done", "label": "{<= 800 ms}" },
     { "id": "c-finished", "type": "uml.TimeConstraint", "from": "w-done", "label": "{<= 1000 ms}" }
    ] } }
 ]
}
