{
 "$schema": "../../lib/umlimator.schema.json",
 "schemaVersion": 2,
 "title": "Communication diagram",
 "root": "checkout",
 "nodes": [
  { "id": "shopper", "type": "uml.Lifeline", "label": "shopper", "props": { "represents": "Shopper", "stereotypes": ["actor"] } },
  { "id": "storefront", "type": "uml.Lifeline", "label": "storefront", "props": { "represents": "Storefront" } },
  { "id": "api", "type": "uml.Lifeline", "label": "api", "props": { "represents": "ShopApi" } },
  { "id": "payments", "type": "uml.Lifeline", "label": "payments", "props": { "represents": "PaymentProvider" } },
  { "id": "bank", "type": "uml.Lifeline", "label": "bank", "props": { "represents": "CardNetwork" } },
  { "id": "basket", "type": "uml.Lifeline", "label": "basket", "props": { "represents": "Basket" } },
  { "id": "receipt", "type": "uml.Lifeline", "label": "receipt", "props": { "represents": "Receipt" } },
  { "id": "stock", "type": "uml.Lifeline", "label": "stock", "props": { "represents": "StockLedger" } }
 ],
 "edges": [
  { "id": "c-shopper-storefront", "type": "uml.Connector", "from": "shopper", "to": "storefront" },
  { "id": "c-storefront-api", "type": "uml.Connector", "from": "storefront", "to": "api" },
  { "id": "c-api-self", "type": "uml.Connector", "from": "api", "to": "api" },
  { "id": "c-api-payments", "type": "uml.Connector", "from": "api", "to": "payments" },
  { "id": "c-payments-bank", "type": "uml.Connector", "from": "payments", "to": "bank" },
  { "id": "c-api-basket", "type": "uml.Connector", "from": "api", "to": "basket" },
  { "id": "c-api-receipt", "type": "uml.Connector", "from": "api", "to": "receipt" },
  { "id": "c-api-stock", "type": "uml.Connector", "from": "api", "to": "stock" },
  { "id": "m-checkout", "type": "uml.Message", "from": "shopper", "to": "storefront", "label": "checkout()", "props": { "sort": "call" } },
  { "id": "m-place", "type": "uml.Message", "from": "storefront", "to": "api", "label": "place(order)", "props": { "sort": "call", "stereotypes": ["secure"] } },
  { "id": "m-validate", "type": "uml.Message", "from": "api", "to": "api", "label": "validate(order)", "props": { "sort": "call" } },
  { "id": "m-charge", "type": "uml.Message", "from": "api", "to": "payments", "label": "charge(total)", "props": { "sort": "call" } },
  { "id": "m-authorise", "type": "uml.Message", "from": "payments", "to": "bank", "label": "authorise(card)", "props": { "sort": "call" } },
  { "id": "m-approved", "type": "uml.Message", "from": "bank", "to": "payments", "label": "approved", "props": { "sort": "reply", "replyTo": "m-authorise" } },
  { "id": "m-paid", "type": "uml.Message", "from": "payments", "to": "api", "label": "paid", "props": { "sort": "reply", "replyTo": "m-charge" } },
  { "id": "m-new-receipt", "type": "uml.Message", "from": "api", "to": "receipt", "label": "new(order)", "props": { "sort": "create" } },
  { "id": "m-clear", "type": "uml.Message", "from": "api", "to": "basket", "label": "clear()", "props": { "sort": "delete" } },
  { "id": "m-placed", "type": "uml.Message", "from": "api", "to": "storefront", "label": "orderPlaced", "props": { "sort": "async" } },
  { "id": "m-result", "type": "uml.Message", "from": "api", "to": "storefront", "label": "result", "props": { "sort": "reply", "replyTo": "m-place" } },
  { "id": "m-page", "type": "uml.Message", "from": "storefront", "to": "shopper", "label": "confirmation page", "props": { "sort": "reply", "replyTo": "m-checkout" } }
 ],
 "views": [
  { "id": "checkout", "diagram": "uml.communication", "title": "Checkout, the card accepted", "parent": null, "direction": "down",
   "nodeIds": ["shopper", "storefront", "api", "payments", "bank", "basket", "receipt", "stock"],
   "edges": ["c-shopper-storefront", "c-storefront-api", "c-api-self", "c-api-payments", "c-payments-bank", "c-api-basket", "c-api-receipt", "c-api-stock",
    "m-checkout", "m-place", "m-validate", "m-charge", "m-authorise", "m-approved", "m-paid", "m-new-receipt", "m-clear", "m-placed", "m-result", "m-page"] },
  { "id": "checkout-right", "diagram": "uml.communication", "title": "The same checkout, laid out right", "parent": "checkout", "direction": "right",
   "nodeIds": ["shopper", "storefront", "api", "payments", "bank", "basket", "receipt", "stock"],
   "edges": ["c-shopper-storefront", "c-storefront-api", "c-api-self", "c-api-payments", "c-payments-bank", "c-api-basket", "c-api-receipt", "c-api-stock",
    "m-checkout", "m-place", "m-validate", "m-charge", "m-authorise", "m-approved", "m-paid", "m-new-receipt", "m-clear", "m-placed", "m-result", "m-page"] }
 ]
}
