{
 "$schema": "../../lib/umlimator.schema.json",
 "schemaVersion": 2,
 "title": "Composite structure diagram",
 "root": "inside",
 "nodes": [
  {
   "id": "order-service",
   "type": "uml.Class",
   "label": "OrderService",
   "members": [
    {
     "id": "order-service.api",
     "type": "uml.Port",
     "label": "api"
    },
    {
     "id": "order-service.payments",
     "type": "uml.Port",
     "label": "payments"
    },
    {
     "id": "order-service.checkout",
     "type": "uml.Property",
     "label": "checkout",
     "props": {
      "valueType": "CheckoutFlow",
      "multiplicity": "1",
      "aggregation": "composite"
     }
    },
    {
     "id": "order-service.pricing",
     "type": "uml.Property",
     "label": "pricing",
     "props": {
      "valueType": "PriceCalculator",
      "multiplicity": "1",
      "aggregation": "composite"
     }
    },
    {
     "id": "order-service.orders",
     "type": "uml.Property",
     "label": "orders",
     "props": {
      "valueType": "OrderRepository",
      "multiplicity": "1",
      "aggregation": "composite"
     }
    },
    {
     "id": "order-service.mailers",
     "type": "uml.Property",
     "label": "mailers",
     "props": {
      "valueType": "Mailer",
      "multiplicity": "1..*",
      "aggregation": "composite"
     }
    },
    {
     "id": "order-service.listeners",
     "type": "uml.Property",
     "label": "listeners",
     "props": {
      "valueType": "OrderListener",
      "multiplicity": "0..*",
      "aggregation": "shared"
     }
    }
   ]
  },
  {
   "id": "checkout-flow",
   "type": "uml.Class",
   "label": "CheckoutFlow",
   "members": [
    {
     "id": "checkout-flow.requests",
     "type": "uml.Port",
     "label": "requests"
    },
    {
     "id": "checkout-flow.quotes",
     "type": "uml.Port",
     "label": "quotes"
    },
    {
     "id": "checkout-flow.charges",
     "type": "uml.Port",
     "label": "charges"
    }
   ]
  },
  {
   "id": "price-calculator",
   "type": "uml.Class",
   "label": "PriceCalculator",
   "members": [
    {
     "id": "price-calculator.quotes",
     "type": "uml.Port",
     "label": "quotes"
    }
   ]
  },
  {
   "id": "order-repository",
   "type": "uml.Class",
   "label": "OrderRepository"
  },
  {
   "id": "mailer",
   "type": "uml.Class",
   "label": "Mailer"
  },
  {
   "id": "order-listener",
   "type": "uml.Class",
   "label": "OrderListener"
  },
  {
   "id": "order-events",
   "type": "uml.CollaborationUse",
   "label": "orderEvents",
   "parent": "order-service",
   "props": {
    "collaboration": "PublishSubscribe"
   }
  },
  {
   "id": "publish-subscribe",
   "type": "uml.Collaboration",
   "label": "PublishSubscribe",
   "members": [
    {
     "id": "publish-subscribe.publisher",
     "type": "uml.Property",
     "label": "publisher",
     "props": {
      "valueType": "EventSource",
      "multiplicity": "1"
     }
    },
    {
     "id": "publish-subscribe.subscriber",
     "type": "uml.Property",
     "label": "subscriber",
     "props": {
      "valueType": "EventListener",
      "multiplicity": "0..*"
     }
    }
   ]
  },
  {
   "id": "note-payments",
   "type": "uml.Comment",
   "label": "payments goes out to the card gateway"
  }
 ],
 "edges": [
  {
   "id": "api-to-checkout",
   "type": "uml.Connector",
   "from": "order-service.api",
   "to": "checkout-flow.requests",
   "props": {
    "ends": {
     "to": {
      "part": "order-service.checkout"
     }
    }
   }
  },
  {
   "id": "checkout-to-pricing",
   "type": "uml.Connector",
   "from": "checkout-flow.quotes",
   "to": "price-calculator.quotes",
   "props": {
    "ends": {
     "from": {
      "part": "order-service.checkout"
     },
     "to": {
      "part": "order-service.pricing"
     }
    }
   }
  },
  {
   "id": "checkout-to-payments",
   "type": "uml.Connector",
   "from": "checkout-flow.charges",
   "to": "order-service.payments",
   "props": {
    "ends": {
     "from": {
      "part": "order-service.checkout"
     }
    }
   }
  },
  {
   "id": "checkout-to-orders",
   "type": "uml.Connector",
   "from": "order-service.checkout",
   "to": "order-service.orders"
  },
  {
   "id": "orders-to-mailers",
   "type": "uml.Connector",
   "from": "order-service.orders",
   "to": "order-service.mailers"
  },
  {
   "id": "checkout-to-listeners",
   "type": "uml.Connector",
   "from": "order-service.checkout",
   "to": "order-service.listeners"
  },
  {
   "id": "publisher-to-subscriber",
   "type": "uml.Connector",
   "from": "publish-subscribe.publisher",
   "to": "publish-subscribe.subscriber"
  },
  {
   "id": "checkout-is-publisher",
   "type": "uml.RoleBinding",
   "from": "order-service.checkout",
   "to": "order-events",
   "label": "publisher"
  },
  {
   "id": "listeners-are-subscribers",
   "type": "uml.RoleBinding",
   "from": "order-service.listeners",
   "to": "order-events",
   "label": "subscriber"
  },
  {
   "id": "note-payments-link",
   "type": "uml.CommentLink",
   "from": "note-payments",
   "to": "order-service.payments"
  }
 ],
 "views": [
  {
   "id": "inside",
   "diagram": "uml.composite-structure",
   "title": "Inside the bookshop's OrderService",
   "parent": null,
   "subject": "order-service",
   "nodeIds": [
    "order-service",
    "order-events",
    "publish-subscribe",
    "note-payments"
   ],
   "present": {
    "order-service.api": {
     "side": "left"
    },
    "order-service.payments": {
     "side": "right"
    }
   },
   "layout": {
    "order-service.listeners": [
     1,
     3
    ],
    "note-payments": [
     3,
     3
    ]
   }
  },
  {
   "id": "inside-down",
   "diagram": "uml.composite-structure",
   "title": "The same structure, laid out down",
   "parent": "inside",
   "direction": "down",
   "subject": "order-service",
   "nodeIds": [
    "order-service",
    "order-events",
    "publish-subscribe",
    "note-payments"
   ],
   "present": {
    "order-service.payments": {
     "side": "bottom"
    }
   },
   "layout": {
    "note-payments": [
     1,
     1
    ]
   }
  },
  {
   "id": "events",
   "diagram": "uml.composite-structure",
   "title": "PublishSubscribe as the subject",
   "parent": "inside",
   "subject": "publish-subscribe",
   "nodeIds": [
    "publish-subscribe"
   ]
  }
 ]
}