{
  "version": "1.0.0",
  "initial": "Anon",
  "states": {
    "Anon":          { "available": ["login"] },
    "Authenticated": { "available": ["search","checkout"] }
  },
  "transitions": [
    { "from": "Anon", "event": "login_ok", "to": "Authenticated" }
  ],
  "actions": {
    "login": {
      "form": { "method": "POST", "target": "/api/login", "contentType": "application/json" },
      "expects":  { "$ref": "#/schemas/LoginInput" },
      "emits": { "onSuccess": "login_ok", "onError": "login_failed" }
    }
  },
  "schemas": {
    "LoginInput": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "required": ["email","password"],
      "properties": {
        "email": { "type": "string", "format": "email" },
        "password": { "type": "string", "minLength": 8 }
      }
    }
  },
  "site": {
    "name": "Example Shop",
    "baseUrl": "https://shop.example.com"
  }
}
