{
  "schema_version": 1,
  "diagram_type": "architecture",
  "meta": {
    "title": "KBP domain model: aggregates and owning systems",
    "output": "docs/architecture/arc42/assets/kbp-domain-map.html",
    "quality_profile": "showcase",
    "locale": "en",
    "views": [
      { "id": "customer", "label": "Customer and master data", "focus": ["identity", "masterdata", "mek", "emob", "cim", "cmdm", "auth0", "emobbilling"], "note": "Who the customer is: identities across systems, master data, portal account and the e-mobility debitor." },
      { "id": "commodity", "label": "Contracts, offers and money", "focus": ["contracts", "offers", "accounting", "relocation", "enwicore", "comv3", "apa", "cl"], "note": "Commodity contracts and consumption, offers and orders, the financial account and relocation." },
      { "id": "processes", "label": "Processes and services", "focus": ["tasks", "permissions", "pin", "nba", "zauv", "permsvc", "pinsvc", "mxo"], "note": "Long-running receivables tasks plus the customer-facing services for permissions, PIN and recommendations." }
    ]
  },
  "components": [
    { "id": "identity", "type": "backend", "label": "Customer & identity", "sublabel": "Customer · Identity · Owner", "pos": [60, 40], "size": [300, 60] },
    { "id": "masterdata", "type": "backend", "label": "Master data", "sublabel": "addresses · contacts · payment · history", "pos": [60, 120], "size": [300, 60] },
    { "id": "mek", "type": "backend", "label": "MyEnergyKey account", "sublabel": "deletion status · registration link", "pos": [60, 200], "size": [300, 60] },
    { "id": "emob", "type": "backend", "label": "E-mobility debitor", "sublabel": "debitor · account · payment methods", "pos": [60, 280], "size": [300, 60] },
    { "id": "contracts", "type": "backend", "label": "Contracts & consumption", "sublabel": "Contract · Tariff · Meter · Deposit · Lock", "pos": [60, 360], "size": [300, 60] },
    { "id": "offers", "type": "backend", "label": "Offers & orders", "sublabel": "ProductOffer · Order · OrderItem", "pos": [60, 440], "size": [300, 60] },
    { "id": "accounting", "type": "backend", "label": "Financial account", "sublabel": "AccountingRecord · Payment · PaymentPlan", "pos": [60, 520], "size": [300, 60] },
    { "id": "relocation", "type": "backend", "label": "Relocation", "sublabel": "ContractRelocationInformation", "pos": [60, 600], "size": [300, 60] },
    { "id": "tasks", "type": "backend", "label": "Receivables tasks", "sublabel": "AuftragResult · ZustandResult · Note", "pos": [60, 680], "size": [300, 60] },
    { "id": "permissions", "type": "backend", "label": "Marketing permissions", "sublabel": "EffectivePermissions · Activity", "pos": [60, 760], "size": [300, 60] },
    { "id": "pin", "type": "backend", "label": "Telephone PIN", "sublabel": "ServicePin", "pos": [60, 840], "size": [300, 60] },
    { "id": "nba", "type": "backend", "label": "Next Best Action & content", "sublabel": "MxoCustomerProfile · NbaContent · Alert", "pos": [60, 920], "size": [300, 60] },

    { "id": "cim", "type": "external", "label": "Customer Identity (CIM)", "sublabel": "identity ids across systems", "pos": [640, 40], "size": [300, 60] },
    { "id": "cmdm", "type": "database", "label": "CMDM", "sublabel": "customer master data", "pos": [640, 120], "size": [300, 60] },
    { "id": "auth0", "type": "security", "label": "Auth0 (MyEnergyKey)", "sublabel": "customer portal accounts", "pos": [640, 200], "size": [300, 60] },
    { "id": "emobbilling", "type": "external", "label": "E-Mobility Billing", "sublabel": "debitor, account, payment", "pos": [640, 280], "size": [300, 60] },
    { "id": "enwicore", "type": "database", "label": "EnWiCore", "sublabel": "commodity contracts · consumption", "pos": [640, 360], "size": [300, 60] },
    { "id": "comv3", "type": "external", "label": "ComV3 (COMtrol)", "sublabel": "com-service · com-order-service", "pos": [640, 440], "size": [300, 60] },
    { "id": "apa", "type": "database", "label": "APA (SAP)", "sublabel": "accounting and payments", "pos": [640, 520], "size": [300, 60] },
    { "id": "cl", "type": "external", "label": "Commodity Layer", "sublabel": "relocation service", "pos": [640, 600], "size": [300, 60] },
    { "id": "zauv", "type": "messagebus", "label": "ZAuV / Digital Layer", "sublabel": "task state machines · events", "pos": [640, 680], "size": [300, 60] },
    { "id": "permsvc", "type": "external", "label": "Permission Service", "sublabel": "consents and revocations", "pos": [640, 760], "size": [300, 60] },
    { "id": "pinsvc", "type": "security", "label": "PIN Service", "sublabel": "telephone PIN", "pos": [640, 840], "size": [300, 60] },
    { "id": "mxo", "type": "external", "label": "MXO · Contentful", "sublabel": "profiles, recommendations, content", "pos": [640, 920], "size": [300, 60] }
  ],
  "boundaries": [
    { "kind": "region", "label": "KBP Core domain model (Core/Entities)", "wraps": ["identity", "masterdata", "mek", "emob", "contracts", "offers", "accounting", "relocation", "tasks", "permissions", "pin", "nba"] },
    { "kind": "region", "label": "Owning business systems (system of record)", "wraps": ["cim", "cmdm", "auth0", "emobbilling", "enwicore", "comv3", "apa", "cl", "zauv", "permsvc", "pinsvc", "mxo"] }
  ],
  "connections": [
    { "from": "identity", "to": "cim", "label": "resolves ids", "variant": "emphasis", "fromSide": "right", "toSide": "left", "route": "straight" },
    { "from": "masterdata", "to": "cmdm", "label": "reads / writes", "fromSide": "right", "toSide": "left", "route": "straight" },
    { "from": "mek", "to": "auth0", "label": "Management API", "variant": "security", "fromSide": "right", "toSide": "left", "route": "straight" },
    { "from": "emob", "to": "emobbilling", "label": "reads", "fromSide": "right", "toSide": "left", "route": "straight" },
    { "from": "contracts", "to": "enwicore", "label": "reads / changes", "variant": "emphasis", "fromSide": "right", "toSide": "left", "route": "straight" },
    { "from": "offers", "to": "comv3", "label": "offers · orders", "fromSide": "right", "toSide": "left", "route": "straight" },
    { "from": "accounting", "to": "apa", "label": "balances · plans", "fromSide": "right", "toSide": "left", "route": "straight" },
    { "from": "relocation", "to": "cl", "label": "relocation process", "fromSide": "right", "toSide": "left", "route": "straight" },
    { "from": "tasks", "to": "zauv", "label": "state transitions", "variant": "dashed", "fromSide": "right", "toSide": "left", "route": "straight" },
    { "from": "permissions", "to": "permsvc", "label": "activities", "fromSide": "right", "toSide": "left", "route": "straight" },
    { "from": "pin", "to": "pinsvc", "label": "check · create", "variant": "security", "fromSide": "right", "toSide": "left", "route": "straight" },
    { "from": "nba", "to": "mxo", "label": "profile · interactions", "fromSide": "right", "toSide": "left", "route": "straight" }
  ],
  "cards": [
    { "dot": "cyan", "title": "Read model, not a database", "items": ["KBP owns no business data; every aggregate mirrors a system of record", "Customer.Identity carries the ids that link the aggregates"] },
    { "dot": "emerald", "title": "Where the entities live", "items": ["Core/Entities is the only home of domain types", "Infrastructure.Data maps each system's contract onto them"] },
    { "dot": "amber", "title": "Details", "items": ["Attributes and enumerations per aggregate are in the Domain Model page", "Feature-to-entity mapping is in the requirements section"] }
  ]
}
