{
  "schema_version": 2,
  "diagram_type": "workflow",
  "meta": {
    "title": "PIN administration user actions",
    "quality_profile": "showcase",
    "locale": "en"
  },
  "lanes": [
    {
      "id": "agent",
      "label": "Agent (any role)"
    },
    {
      "id": "superuser",
      "label": "Agent with superuser role"
    }
  ],
  "mainPath": [
    "start",
    "has_pin",
    "admin_actions",
    "end"
  ],
  "semanticChecks": {
    "allowedRoots": [
      "start"
    ],
    "allowedTerminals": [
      "end"
    ]
  },
  "nodes": [
    {
      "id": "start",
      "lane": "agent",
      "col": 0,
      "type": "frontend",
      "label": "Start",
      "sublabel": "open PIN admin"
    },
    {
      "id": "has_pin",
      "lane": "agent",
      "col": 1,
      "type": "backend",
      "label": "Has PIN?",
      "sublabel": "customer PIN exists"
    },
    {
      "id": "admin_actions",
      "lane": "agent",
      "col": 2,
      "type": "backend",
      "label": "Admin actions",
      "sublabel": "link, SMS, generate"
    },
    {
      "id": "end",
      "lane": "agent",
      "col": 5,
      "type": "external",
      "label": "End"
    },
    {
      "id": "generate_pin",
      "lane": "superuser",
      "col": 2,
      "type": "security",
      "label": "Generate PIN",
      "sublabel": "send to customer"
    },
    {
      "id": "status_actions",
      "lane": "superuser",
      "col": 3,
      "type": "security",
      "label": "Status actions",
      "sublabel": "deactivate, seen flag"
    },
    {
      "id": "delete_pin",
      "lane": "superuser",
      "col": 4,
      "type": "security",
      "label": "Delete PIN",
      "sublabel": "current PIN"
    }
  ],
  "edges": [
    {
      "from": "start",
      "to": "has_pin",
      "role": "main"
    },
    {
      "from": "has_pin",
      "to": "admin_actions",
      "label": "Yes",
      "role": "main",
      "fromSide": "right",
      "toSide": "left"
    },
    {
      "from": "admin_actions",
      "to": "end",
      "role": "main",
      "fromSide": "right",
      "toSide": "left",
      "route": "straight"
    },
    {
      "from": "has_pin",
      "to": "generate_pin",
      "label": "No",
      "role": "branch",
      "fromSide": "bottom",
      "toSide": "top"
    },
    {
      "from": "generate_pin",
      "to": "end",
      "role": "branch"
    },
    {
      "from": "admin_actions",
      "to": "status_actions",
      "label": "superuser",
      "role": "branch",
      "variant": "dashed",
      "fromSide": "bottom",
      "toSide": "top"
    },
    {
      "from": "admin_actions",
      "to": "delete_pin",
      "role": "branch",
      "variant": "dashed",
      "fromSide": "bottom",
      "toSide": "top"
    },
    {
      "from": "status_actions",
      "to": "end",
      "role": "branch"
    },
    {
      "from": "delete_pin",
      "to": "end",
      "role": "branch",
      "fromSide": "top",
      "toSide": "bottom"
    }
  ],
  "cards": [
    {
      "dot": "cyan",
      "title": "Admin actions (any agent)",
      "items": [
        "Send customer-portal link for self-service",
        "Send current PIN to customer via SMS",
        "Generate PIN and send to customer"
      ]
    },
    {
      "dot": "amber",
      "title": "Status actions (superuser)",
      "items": [
        "Deactivate PIN",
        "Set \"PIN seen by customer\" true or false"
      ]
    },
    {
      "dot": "rose",
      "title": "Superuser only",
      "items": [
        "Delete current PIN",
        "Generate PIN when customer has none yet"
      ]
    }
  ]
}
