{
 "$schema": "../../lib/umlimator.schema.json",
 "schemaVersion": 2,
 "title": "Profile diagram",
 "root": "conventions-view",
 "nodes": [
  { "id": "conventions", "type": "uml.Profile", "label": "BookshopConventions" },
  { "id": "mc-class", "type": "uml.MetaclassReference", "label": "Class", "parent": "conventions" },
  { "id": "mc-property", "type": "uml.MetaclassReference", "label": "Property", "parent": "conventions" },
  { "id": "mc-package", "type": "uml.MetaclassReference", "label": "Package", "parent": "conventions" },
  { "id": "record", "type": "uml.Stereotype", "label": "record", "parent": "conventions", "props": { "isAbstract": true },
   "members": [
    { "id": "record.retainDays", "type": "uml.Property", "label": "retainDays", "props": { "valueType": "Integer", "default": "365" } }
   ] },
  { "id": "entity", "type": "uml.Stereotype", "label": "entity", "parent": "conventions",
   "members": [
    { "id": "entity.table", "type": "uml.Property", "label": "table", "props": { "valueType": "String" } }
   ] },
  { "id": "aggregate-root", "type": "uml.Stereotype", "label": "aggregateRoot", "parent": "conventions",
   "members": [
    { "id": "aggregate-root.boundedContext", "type": "uml.Property", "label": "boundedContext", "props": { "valueType": "String" } }
   ] },
  { "id": "owned", "type": "uml.Stereotype", "label": "owned", "parent": "conventions",
   "members": [
    { "id": "owned.team", "type": "uml.Property", "label": "team", "props": { "valueType": "String", "multiplicity": "0..1" } }
   ] },
  { "id": "column", "type": "uml.Stereotype", "label": "column", "parent": "conventions",
   "members": [
    { "id": "column.name", "type": "uml.Property", "label": "name", "props": { "valueType": "String", "multiplicity": "0..1" } },
    { "id": "column.indexed", "type": "uml.Property", "label": "indexed", "props": { "valueType": "Boolean", "default": "false" } },
    { "id": "column.kind", "type": "uml.Property", "label": "kind", "props": { "valueType": "ColumnKind", "default": "plain" } }
   ] },
  { "id": "column-kind", "type": "uml.Enumeration", "label": "ColumnKind", "parent": "conventions",
   "members": [
    { "id": "column-kind.plain", "type": "uml.EnumerationLiteral", "label": "plain" },
    { "id": "column-kind.key", "type": "uml.EnumerationLiteral", "label": "key" },
    { "id": "column-kind.money", "type": "uml.EnumerationLiteral", "label": "money" }
   ] },
  { "id": "module", "type": "uml.Stereotype", "label": "module", "parent": "conventions",
   "members": [
    { "id": "module.owner", "type": "uml.Property", "label": "owner", "props": { "valueType": "String", "multiplicity": "0..1" } }
   ] },
  { "id": "audit", "type": "uml.Profile", "label": "Audit" },
  { "id": "audit-class", "type": "uml.MetaclassReference", "label": "Class", "parent": "audit" },
  { "id": "audit-record", "type": "uml.Stereotype", "label": "record", "parent": "audit",
   "members": [
    { "id": "audit-record.keepYears", "type": "uml.Property", "label": "keepYears", "props": { "valueType": "Integer" } }
   ] },
  { "id": "sales", "type": "uml.Package", "label": "sales" },
  { "id": "payments", "type": "uml.Package", "label": "payments", "parent": "sales",
   "props": { "stereotypes": ["module"], "tags": { "module": { "owner": "finance" } } } },
  { "id": "order", "type": "uml.Class", "label": "Order", "parent": "sales",
   "props": { "stereotypes": ["aggregateRoot", "Audit::record"],
    "tags": { "aggregateRoot": { "table": "orders", "boundedContext": "sales", "retainDays": "3650" }, "owned": { "team": "checkout" }, "Audit::record": { "keepYears": "7" } } },
   "members": [
    { "id": "order.placedAt", "type": "uml.Property", "label": "placedAt",
     "props": { "visibility": "private", "valueType": "Instant", "stereotypes": ["column"], "tags": { "column": { "name": "placed_at", "indexed": "true" } } } },
    { "id": "order.id", "type": "uml.Property", "label": "id",
     "props": { "visibility": "private", "valueType": "UUID", "stereotypes": ["column"], "tags": { "column": { "kind": "key" } } } }
   ] },
  { "id": "line", "type": "uml.Class", "label": "OrderLine", "parent": "sales",
   "props": { "stereotypes": ["entity"], "tags": { "entity": { "table": "order_lines" }, "owned": { "team": "checkout" } } },
   "members": [
    { "id": "line.unitPrice", "type": "uml.Property", "label": "unitPrice",
     "props": { "visibility": "private", "valueType": "Money", "stereotypes": ["column"], "tags": { "column": { "name": "unit_price", "kind": "money" } } } }
   ] },
  { "id": "note-record", "type": "uml.Comment", "parent": "conventions", "label": "record is abstract: apply entity or aggregateRoot" }
 ],
 "edges": [
  { "id": "record-extends-class", "type": "uml.Extension", "from": "record", "to": "mc-class" },
  { "id": "owned-extends-class", "type": "uml.Extension", "from": "owned", "to": "mc-class", "props": { "isRequired": true } },
  { "id": "column-extends-property", "type": "uml.Extension", "from": "column", "to": "mc-property" },
  { "id": "module-extends-package", "type": "uml.Extension", "from": "module", "to": "mc-package" },
  { "id": "entity-is-record", "type": "uml.Generalization", "from": "entity", "to": "record" },
  { "id": "root-is-entity", "type": "uml.Generalization", "from": "aggregate-root", "to": "entity" },
  { "id": "audit-record-extends-class", "type": "uml.Extension", "from": "audit-record", "to": "audit-class" },
  { "id": "sales-applies-conventions", "type": "uml.ProfileApplication", "from": "sales", "to": "conventions" },
  { "id": "sales-applies-audit", "type": "uml.ProfileApplication", "from": "sales", "to": "audit" },
  { "id": "note-record-link", "type": "uml.CommentLink", "from": "note-record", "to": "record" }
 ],
 "views": [
  { "id": "conventions-view", "diagram": "uml.profile", "title": "The bookshop's modelling conventions", "parent": null, "direction": "down",
   "nodeIds": ["conventions", "mc-class", "mc-property", "mc-package", "record", "entity", "aggregate-root", "owned", "column", "column-kind", "module", "audit", "audit-class", "audit-record", "sales", "payments", "order", "line", "note-record"] },
  { "id": "conventions-right", "diagram": "uml.profile", "title": "The same conventions, laid out right", "parent": "conventions-view", "direction": "right",
   "nodeIds": ["conventions", "mc-class", "mc-property", "mc-package", "record", "entity", "aggregate-root", "owned", "column", "column-kind", "module", "audit", "audit-class", "audit-record", "sales", "payments", "order", "line", "note-record"] }
 ]
}
