{
  "version": "7.1",
  "data_api_version": "3.0",
  "routing_model": {
    "SEARCH": [
      "RESULTS"
    ],
    "RESULTS": []
  },
  "screens": [
    {
      "id": "SEARCH",
      "title": "Search products",
      "data": {
        "categories": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "title": {
                "type": "string"
              }
            }
          },
          "__example__": [
            {
              "id": "all",
              "title": "All products"
            }
          ]
        },
        "message": {
          "type": "string",
          "__example__": ""
        }
      },
      "layout": {
        "type": "SingleColumnLayout",
        "children": [
          {
            "type": "Form",
            "name": "form",
            "children": [
              {
                "type": "TextHeading",
                "text": "What are you looking for?"
              },
              {
                "type": "TextBody",
                "text": "${data.message}"
              },
              {
                "type": "TextInput",
                "name": "query",
                "label": "Product name or SKU",
                "input-type": "text",
                "max-chars": 100
              },
              {
                "type": "Dropdown",
                "name": "category",
                "label": "Category",
                "required": true,
                "data-source": "${data.categories}"
              },
              {
                "type": "Footer",
                "label": "Search",
                "on-click-action": {
                  "name": "data_exchange",
                  "payload": {
                    "query": "${form.query}",
                    "category": "${form.category}"
                  }
                }
              }
            ]
          }
        ]
      }
    },
    {
      "id": "RESULTS",
      "title": "Search results",
      "data": {
        "products": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "enabled": {
                "type": "boolean"
              }
            }
          },
          "__example__": [
            {
              "id": "product-id",
              "title": "Milk 1L",
              "description": "USD 1.60 \u00b7 In stock",
              "enabled": true
            }
          ]
        },
        "message": {
          "type": "string",
          "__example__": "Showing up to 20 results."
        }
      },
      "layout": {
        "type": "SingleColumnLayout",
        "children": [
          {
            "type": "Form",
            "name": "form",
            "children": [
              {
                "type": "TextBody",
                "text": "${data.message}"
              },
              {
                "type": "RadioButtonsGroup",
                "name": "product",
                "label": "Choose a product",
                "required": true,
                "data-source": "${data.products}"
              },
              {
                "type": "Footer",
                "label": "Select product",
                "on-click-action": {
                  "name": "data_exchange",
                  "payload": {
                    "product": "${form.product}"
                  }
                }
              }
            ]
          }
        ]
      },
      "terminal": true,
      "success": true
    }
  ]
}
