{
 "$schema": "../../lib/umlimator.schema.json",
 "schemaVersion": 2,
 "title": "Map",
 "root": "shop",
 "lenses": [
  { "id": "by-owner", "title": "Who owns what", "color": "owner" },
  { "id": "money", "title": "Where the money goes", "pick": { "line": ["feeds"] } }
 ],
 "nodes": [
  { "id": "shoppers", "label": "Shoppers", "kind": "person", "sublabel": "browse and buy", "what": "The people who buy books: a `person` card is drawn as a person." },
  { "id": "staff", "label": "Shop staff", "kind": "user", "sublabel": "pack and answer", "what": "People outside the system: a `user` card is drawn as a person." },
  { "id": "storefront", "label": "Storefront", "kind": "frontend", "icon": "react", "sublabel": "React", "owner": "web team", "badges": ["public"], "what": "A `frontend` card: a browser app, its title bar and address field over the card." },
  { "id": "app", "label": "Shop app", "kind": "mobile", "sublabel": "iOS and Android", "owner": "web team", "change": "new", "what": "A `mobile` card, a phone on its side, marked NEW." },
  { "id": "back-office", "label": "Back office", "kind": "frontend", "shape": "window", "sublabel": "staff only", "owner": "ops team", "what": "Its own `shape`, a window: a card's `shape` wins over its kind." },
  { "id": "cli", "label": "Admin CLI", "kind": "cli", "sublabel": "python3", "owner": "ops team", "noSub": true, "what": "A `cli` card, a terminal; `noSub` keeps its sub-line in the panel only." },
  { "id": "api", "label": "Shop API", "kind": "backend", "icon": "fastapi", "sublabel": "FastAPI", "owner": "platform team", "badges": [{ "text": "on call", "tone": "rose" }], "verbs": ["checkout", "refund"], "edited": true, "emphasis": true, "what": "The heart of the shop, drawn as a main step, with chips, a badge in a tone and an edit mark." },
  { "id": "pricing", "label": "Pricing", "kind": "module", "sublabel": "discounts, tax", "owner": "platform team", "what": "A `module` card: a folder." },
  { "id": "fraud", "label": "Fraud check", "kind": "hook", "sublabel": "fires on its own", "owner": "platform team", "what": "A `hook` card: a hexagon." },
  { "id": "orders", "label": "Orders", "kind": "database", "icon": "postgresql", "sublabel": "PostgreSQL", "owner": "platform team", "badges": [{ "text": "backed up", "tone": "green" }], "what": "A `database` card: a cylinder." },
  { "id": "queue", "label": "Order queue", "kind": "queue", "sublabel": "RabbitMQ", "owner": "platform team", "what": "A `queue` card: a pipe, open where the work leaves." },
  { "id": "agent", "label": "Support agent", "kind": "agent", "sublabel": "drafts replies", "owner": "ops team", "what": "An `agent` card: a robot." },
  { "id": "policies", "label": "returns.md", "kind": "file", "sublabel": "returns policy", "owner": "ops team", "what": "A `file` card: a page with its corner folded." },
  { "id": "hosts", "label": "Hosts", "kind": "cloud", "sublabel": "two servers", "what": "A `cloud` card: a box seen in perspective." },
  { "id": "gateway", "label": "Card gateway", "kind": "external", "sublabel": "cards, refunds", "what": "Outside the shop: an `external` card is dashed." },
  { "id": "gift-cards", "label": "Gift cards", "kind": "backend", "sublabel": "next quarter", "owner": "platform team", "change": "planned", "what": "Not built yet: a PLANNED card is dashed." },
  { "id": "reminders", "label": "Reminder bot", "kind": "ai", "icon": "bot", "sublabel": "nudges carts", "owner": "web team", "change": "removed", "what": "Switched off: a REMOVED card is dashed." }
 ],
 "edges": [
  { "id": "browse", "from": "shoppers", "to": "storefront", "label": "browse, buy", "step": 1 },
  { "id": "on-the-go", "from": "shoppers", "to": "app", "label": "on the go", "change": "added" },
  { "id": "checkout", "from": "storefront", "to": "api", "label": "POST /orders", "sublabel": "JSON", "step": 2, "weight": 3 },
  { "id": "app-order", "from": "app", "to": "api", "label": "order", "weight": 2 },
  { "id": "manage", "from": "back-office", "to": "api", "label": "manage" },
  { "id": "jobs", "from": "cli", "to": "api", "label": "runs jobs", "style": "dashed" },
  { "id": "price", "from": "api", "to": "pricing", "label": "prices", "step": 3 },
  { "id": "check", "from": "api", "to": "fraud", "label": "checks", "kind": "triggers", "step": "3a" },
  { "id": "charge", "from": "api", "to": "gateway", "label": "charges", "kind": "feeds", "style": "security", "step": 4, "weight": 2 },
  { "id": "save", "from": "api", "to": "orders", "label": "saves", "kind": "feeds", "step": 5, "edited": true },
  { "id": "paid", "from": "api", "to": "queue", "label": "paid order", "kind": "state", "style": "async", "step": 6 },
  { "id": "tickets", "from": "queue", "to": "agent", "label": "tickets" },
  { "id": "read", "from": "agent", "to": "policies", "label": "reads", "kind": "state" },
  { "id": "refund-rule", "from": "policies", "to": "gateway", "label": "if within 14 days", "kind": "guard" },
  { "id": "answer", "from": "staff", "to": "back-office", "label": "pack, answer" },
  { "id": "redeem", "from": "api", "to": "gift-cards", "label": "redeem", "change": "added" },
  { "id": "nudge", "from": "reminders", "to": "storefront", "label": "nudges", "change": "removed" },
  { "id": "runs-on", "from": "hosts", "to": "platform", "label": "runs" }
 ],
 "views": [
  { "id": "shop", "title": "The bookshop's systems", "caption": "Who uses the shop, what runs it, and where an order goes.", "parent": null,
   "layout": { "gateway": [6, 0] },
   "nodeIds": ["shoppers", "staff", "storefront", "app", "back-office", "cli", "api", "pricing", "fraud", "orders", "queue", "agent", "policies", "hosts", "gateway", "gift-cards", "reminders"],
   "containers": [
    { "id": "platform", "label": "Shop platform", "nodeIds": ["api", "pricing", "fraud", "gift-cards"], "badges": [{ "text": "EU", "tone": "accent" }] },
    { "id": "data", "label": "Data", "parent": "platform", "nodeIds": ["orders", "queue"], "tone": "green", "badges": ["backed up nightly"] },
    { "id": "support", "label": "Support", "nodeIds": ["agent", "policies"], "tone": "violet" }
   ] },
  { "id": "shop-run", "title": "An order, in run order", "caption": "The same cards and lines a checkout touches, as a numbered view.", "parent": "shop", "render": "sequence",
   "nodeIds": ["shoppers", "storefront", "api", "pricing", "fraud", "gateway", "orders", "queue"],
   "edges": ["browse", "checkout", "price", "check", "charge", "save", "paid"] }
 ]
}
