{
  "protocol": "smartwebui.surface/1.0",
  "expect": {
    "rich": [
      "data-smart-richtext",
      "role=\"textbox\"",
      "Plain text"
    ],
    "board": [
      "data-smart-board",
      "data-column-id=\"todo\"",
      "data-card-id=\"task-1\""
    ],
    "conversation": [
      "data-smart-conversation",
      "role=\"log\"",
      "aria-live=\"off\"",
      "data-smart-composer",
      "data-smart-stream=\"pending\""
    ],
    "live-region": [
      "data-smart-live=\"/status\"",
      "data-smart-live-indicator=\"true\""
    ],
    "composer": [
      "data-smart-composer",
      "aria-label=\"Reply\"",
      "data-smart-composer-send"
    ],
    "map": [
      "data-smart-mapkit",
      "data-smart-map-canvas",
      "data-smart-map-location"
    ],
    "grid": [
      "data-smart-data-grid",
      "<table",
      "data-row-id=\"one\"",
      "data-grid-column=\"name\""
    ],
    "media": [
      "data-smart-media",
      "<video",
      "controls"
    ],
    "playlist": [
      "data-smart-media",
      "<audio",
      "data-src=\"./episode.mp3\"",
      "data-title=\"Episode one\""
    ],
    "signature": [
      "data-smart-signature",
      "data-signature-canvas",
      "data-signature-value"
    ],
    "filter": [
      "data-smart-filter-bar",
      "data-smart-filter-view-label",
      "data-smart-anchor=\"qa-filters-views-trigger\""
    ],
    "notifications": [
      "data-smart-notification-unread-count=\"120\"",
      "id=\"qa-notifications-trigger\"",
      "data-smart-anchor=\"qa-notifications-trigger\"",
      ">99+<"
    ]
  },
  "valid": [
    {
      "surface": "rich",
      "root": {
        "type": "RichText",
        "id": "rich",
        "label": "Notes",
        "value": "Plain text",
        "toolbar": [
          "bold",
          "link"
        ]
      }
    },
    {
      "surface": "board",
      "root": {
        "type": "Board",
        "id": "board",
        "label": "Delivery",
        "columns": [
          {
            "id": "todo",
            "label": "To do",
            "items": [
              {
                "id": "task-1",
                "title": "Review"
              }
            ]
          }
        ]
      }
    },
    {
      "surface": "conversation",
      "root": {
        "type": "Conversation",
        "id": "chat",
        "label": "Support chat",
        "messages": [
          {
            "author": "Support",
            "text": "How can we help?"
          },
          {
            "author": "Agent",
            "text": "",
            "streaming": true
          }
        ],
        "announce": "off",
        "composer": {
          "placeholder": "Reply"
        }
      }
    },
    {
      "surface": "live-region",
      "root": {
        "type": "Text",
        "id": "status",
        "text": "Online",
        "live": {
          "url": "/status",
          "indicator": true
        }
      }
    },
    {
      "surface": "composer",
      "root": {
        "type": "Composer",
        "id": "reply",
        "label": "Reply",
        "attachments": true
      }
    },
    {
      "surface": "map",
      "root": {
        "type": "Map",
        "id": "map",
        "label": "Offices",
        "latitude": 37.77,
        "longitude": -122.42,
        "locations": [
          {
            "title": "San Francisco",
            "latitude": 37.77,
            "longitude": -122.42
          }
        ]
      }
    },
    {
      "surface": "grid",
      "root": {
        "type": "DataGrid",
        "id": "grid",
        "label": "Accounts",
        "columns": [
          {
            "key": "name",
            "label": "Name"
          }
        ],
        "rows": [
          {
            "id": "one",
            "cells": {
              "name": "Acme"
            }
          }
        ]
      }
    },
    {
      "surface": "media",
      "root": {
        "type": "MediaPlayer",
        "id": "media",
        "label": "Product film",
        "mediaType": "video",
        "src": "./film.mp4",
        "captions": "./film.vtt"
      }
    },
    {
      "surface": "playlist",
      "root": {
        "type": "MediaPlayer",
        "id": "playlist",
        "label": "Episodes",
        "mediaType": "playlist",
        "tracks": [
          {
            "title": "Episode one",
            "artist": "smartwebUI",
            "src": "./episode.mp3"
          }
        ]
      }
    },
    {
      "surface": "signature",
      "root": {
        "type": "SignaturePad",
        "id": "signature",
        "label": "Sign agreement",
        "required": true
      }
    },
    {
      "surface": "filter",
      "root": {
        "type": "FilterBar",
        "id": "filters",
        "view": "active",
        "views": [
          {
            "label": "Active customers",
            "value": "active"
          }
        ]
      }
    },
    {
      "surface": "notifications",
      "root": {
        "type": "NotificationCenter",
        "id": "notifications",
        "unreadCount": 120,
        "items": [
          {
            "id": "one",
            "title": "One rendered notification",
            "unread": true
          }
        ]
      }
    }
  ],
  "invalid": [
    {
      "name": "rich text rejects HTML",
      "surface": {
        "surface": "bad-rich",
        "root": {
          "type": "RichText",
          "id": "rich",
          "label": "Notes",
          "html": "<b>unsafe</b>"
        }
      }
    },
    {
      "name": "composer rejects prefills",
      "surface": {
        "surface": "bad-composer",
        "root": {
          "type": "Composer",
          "id": "reply",
          "label": "Reply",
          "value": "Send this for me"
        }
      }
    },
    {
      "name": "map rejects credentials",
      "surface": {
        "surface": "bad-map",
        "root": {
          "type": "Map",
          "id": "map",
          "label": "Offices",
          "token": "secret"
        }
      }
    },
    {
      "name": "grid rejects endpoints",
      "surface": {
        "surface": "bad-grid",
        "root": {
          "type": "DataGrid",
          "id": "grid",
          "label": "Accounts",
          "columns": [],
          "endpoint": "https://example.test"
        }
      }
    },
    {
      "name": "media rejects script URLs",
      "surface": {
        "surface": "bad-media",
        "root": {
          "type": "MediaPlayer",
          "id": "media",
          "label": "Clip",
          "src": "javascript:alert(1)"
        }
      }
    },
    {
      "name": "map rejects invalid nested coordinate types",
      "surface": {
        "surface": "bad-map-coordinate",
        "root": {
          "type": "Map",
          "id": "map",
          "label": "Offices",
          "locations": [
            {
              "title": "Invalid",
              "latitude": "north"
            }
          ]
        }
      }
    },
    {
      "name": "grid rejects structured cell values",
      "surface": {
        "surface": "bad-grid-cell",
        "root": {
          "type": "DataGrid",
          "id": "grid",
          "label": "Accounts",
          "columns": [
            {
              "key": "name"
            }
          ],
          "rows": [
            {
              "cells": {
                "name": {
                  "unexpected": true
                }
              }
            }
          ]
        }
      }
    },
    {
      "name": "signature rejects values",
      "surface": {
        "surface": "bad-signature",
        "root": {
          "type": "SignaturePad",
          "id": "signature",
          "label": "Sign",
          "value": "fabricated"
        }
      }
    },
    {
      "name": "live url rejects javascript",
      "surface": {
        "surface": "bad-live-javascript",
        "root": {
          "type": "Text",
          "id": "status",
          "text": "Online",
          "live": {
            "url": "javascript:alert(1)"
          }
        }
      }
    },
    {
      "name": "live url rejects data",
      "surface": {
        "surface": "bad-live-data",
        "root": {
          "type": "Text",
          "id": "status",
          "text": "Online",
          "live": {
            "url": "data:text/html,hi"
          }
        }
      }
    },
    {
      "name": "conversation announce is not the live endpoint",
      "surface": {
        "surface": "bad-conversation-live",
        "root": {
          "type": "Conversation",
          "id": "chat",
          "label": "Support chat",
          "messages": [
            {
              "text": "Hi"
            }
          ],
          "live": "polite"
        }
      }
    },
    {
      "name": "signature rejects completed state",
      "surface": {
        "surface": "bad-signature-state",
        "root": {
          "type": "SignaturePad",
          "id": "signature",
          "label": "Sign",
          "state": "signed"
        }
      }
    }
  ]
}
