# Service dependency graph with two groups and a contained outage. Scaffold with:
#   python3 scripts/scaffold_from_spec.py pool/service-deps/spec.yaml -o pool/service-deps/service-deps.html
# service-deps.html is hand-built beyond the scaffold (verb nest): fixed column/row layout, sub-labels,
# the failure spreading from the provider along the dependent edges (danger draw-on, no marker), a
# containment outline drawn around the provider and Payments ("blast radius"), and a resting frame
# with the outage contained and everything outside lit as healthy. The spec gives structure and timing.
name: service-deps
archetype: graph
verb: nest
size: [1680, 600]
control: once
cycle: 9.5
nodes:
  - { id: web, label: Web app,          kind: process,  group: edge }
  - { id: gateway, label: API gateway, kind: process,  group: edge }
  - { id: orders, label: Orders,             kind: process,  group: core }
  - { id: payments, label: Payments,             kind: process,  group: core }
  - { id: inventory, label: Inventory,             kind: process,  group: core }
  - { id: db, label: Orders DB,              kind: store,    group: core }
  - { id: queue, label: Event bus,          kind: data }
  - { id: psp, label: Payment provider, sub: third party,      kind: external }
edges:
  - { from: web,       to: gateway,   kind: depends }
  - { from: gateway,   to: orders,    kind: depends }
  - { from: gateway,   to: payments,  kind: depends }
  - { from: orders,    to: inventory, kind: depends }
  - { from: orders,    to: db,        kind: depends }
  - { from: payments,  to: psp,       kind: depends, label: "HTTPS" }
  - { from: orders,    to: queue,     kind: event,   label: "order.placed" }
  - { from: inventory, to: queue,     kind: event }
groups:
  - { id: edge, label: Edge }
  - { id: core, label: Core services }
phases:
  - { t: 0,    label: setup,    show: [edge, web, gateway],     note: "Core services sit behind the gateway" }
  - { t: 0.85, label: core,     show: [core, orders, payments] }
  - { t: 1.45, label: storage,  show: [inventory, db] }
  - { t: 2.0,  label: external, show: [psp, queue] }
  - { t: 2.9,  label: blast,    active: [psp, payments],        note: "Payments calls an external provider" }
  - { t: 5.1,  label: contain,  active: [psp, payments],        note: "Provider down: only Payments degrades, orders keep flowing" }
  - { t: 8.3,  label: hold }
