{
 "$schema": "../../lib/umlimator.schema.json",
 "schemaVersion": 2,
 "title": "Sequence diagram",
 "root": "checkout",
 "nodes": [
  { "id": "shopper", "type": "uml.Lifeline", "label": "shopper", "props": { "represents": "Customer", "stereotypes": ["actor"] } },
  { "id": "storefront", "type": "uml.Lifeline", "label": "storefront", "props": { "represents": "Storefront" } },
  { "id": "api", "type": "uml.Lifeline", "label": "api", "props": { "represents": "ShopApi" } },
  { "id": "hold", "type": "uml.Lifeline", "label": "hold", "props": { "represents": "StockHold" } },
  { "id": "stock", "type": "uml.Lifeline", "label": "stock", "props": { "represents": "Inventory" } },
  { "id": "payments", "type": "uml.Lifeline", "label": "payments", "props": { "represents": "CardGateway" } },
  { "id": "warehouse", "type": "uml.Lifeline", "label": "warehouse", "props": { "represents": "Warehouse" } }
 ],
 "edges": [],
 "views": [
  { "id": "checkout", "diagram": "uml.sequence", "title": "A bookshop's checkout", "parent": null,
   "nodeIds": ["shopper", "storefront", "api", "hold", "stock", "payments", "warehouse"],
   "edges": [
    { "id": "m1", "type": "uml.Message", "from": "shopper", "to": "storefront", "label": "checkout()", "props": { "sort": "call" } },
    { "id": "m2", "type": "uml.Message", "from": "storefront", "to": "api", "label": "place(order)", "props": { "sort": "call" } },
    { "id": "m3", "type": "uml.Message", "from": "api", "to": "storefront", "label": "showError(empty basket)", "parent": "f-empty-op", "props": { "sort": "async" } },
    { "id": "m4", "type": "uml.Message", "from": "api", "to": "api", "label": "validate(order)", "props": { "sort": "call" } },
    { "id": "m5", "type": "uml.Message", "from": "api", "to": "hold", "label": "new(order)", "props": { "sort": "create" } },
    { "id": "m6", "type": "uml.Message", "from": "hold", "to": "stock", "label": "reserve(isbn, qty)", "parent": "f-lines-op", "props": { "sort": "call" } },
    { "id": "m7", "type": "uml.Message", "from": "stock", "to": "hold", "label": "reserved", "parent": "f-lines-op", "props": { "sort": "reply", "replyTo": "m6" } },
    { "id": "m8", "type": "uml.Message", "from": "api", "to": "payments", "label": "charge(total)", "props": { "sort": "call" } },
    { "id": "m9", "type": "uml.Message", "from": "payments", "to": "api", "label": "paid", "parent": "f-pay-ok", "props": { "sort": "reply", "replyTo": "m8" } },
    { "id": "m10", "type": "uml.Message", "from": "api", "to": "storefront", "label": "orderPlaced", "parent": "f-page-op", "props": { "sort": "async" } },
    { "id": "u1", "type": "uml.InteractionUse", "label": "Send receipt email", "parent": "f-par-shopper", "props": { "covers": ["storefront", "api"] } },
    { "id": "m11", "type": "uml.Message", "from": "api", "to": "warehouse", "label": "pickList(order)", "parent": "f-par-warehouse", "props": { "sort": "async", "stereotypes": ["amqp"] } },
    { "id": "m12", "type": "uml.Message", "from": "payments", "to": "api", "label": "declined", "parent": "f-pay-else", "props": { "sort": "reply", "replyTo": "m8" } },
    { "id": "m13", "type": "uml.Message", "from": "api", "to": "stock", "label": "release(order)", "parent": "f-pay-else", "props": { "sort": "async" } },
    { "id": "m14", "type": "uml.Message", "from": "api", "to": "hold", "label": "close()", "props": { "sort": "delete" } },
    { "id": "m15", "type": "uml.Message", "from": "api", "to": "storefront", "label": "result", "props": { "sort": "reply", "replyTo": "m2" } },
    { "id": "m16", "type": "uml.Message", "from": "storefront", "to": "shopper", "label": "confirmation page", "props": { "sort": "reply", "replyTo": "m1" } }
   ],
   "fragments": [
    { "id": "f-empty", "type": "uml.CombinedFragment", "props": { "operator": "break" },
     "members": [ { "id": "f-empty-op", "type": "uml.InteractionOperand", "label": "basket is empty" } ] },
    { "id": "f-lines", "type": "uml.CombinedFragment", "props": { "operator": "loop" },
     "members": [ { "id": "f-lines-op", "type": "uml.InteractionOperand", "label": "for each order line" } ] },
    { "id": "f-pay", "type": "uml.CombinedFragment", "props": { "operator": "alt" },
     "members": [
      { "id": "f-pay-ok", "type": "uml.InteractionOperand", "label": "payment accepted" },
      { "id": "f-pay-else", "type": "uml.InteractionOperand", "label": "else" }
     ] },
    { "id": "f-par", "type": "uml.CombinedFragment", "parent": "f-pay-ok", "props": { "operator": "par" },
     "members": [
      { "id": "f-par-shopper", "type": "uml.InteractionOperand", "label": "tell the shopper" },
      { "id": "f-par-warehouse", "type": "uml.InteractionOperand", "label": "tell the warehouse" }
     ] },
    { "id": "f-page", "type": "uml.CombinedFragment", "parent": "f-par-shopper", "props": { "operator": "opt" },
     "members": [ { "id": "f-page-op", "type": "uml.InteractionOperand", "label": "shopper is still on the page" } ] }
   ] }
 ]
}
