{
  "namespace":"${package}.service",
  "protocol": "OrderProcessingService",
  "doc": "Protocol to submit customer Orders",
  "types": [
    {
      "name": "Item", "type": "record",
      "fields": [
        {"name": "name", "type": "string"},
        {"name": "sku", "type": "long"},
        {"name": "quantity", "type": "int"}
      ]
    },
    {
      "name": "Order", "type": "record",
      "fields": [
        {"name": "customerId", "type": "long"},
        {"name": "orderId", "type": "long"},
        {"name": "orderItems", "type": {"type": "array", "items": "Item"}}
      ]
    },
    {
      "name": "Confirmation", "type": "record",
      "fields": [
        {"name": "customerId", "type": {"type": "long"}},
        {"name": "orderId", "type": "long"},
        {"name": "estimatedCompletion", "type": "long"}
      ]
    },
    {
      "name": "OrderFailure", "type": "error",
      "fields": [
        {"name": "message", "type": "string"}
      ]
    }
   ],

   "messages": {
     "submitOrder": {
       "doc": "Submit an Order",
       "request": [{"name": "order", "type": "Order"}],
       "response": "Confirmation",
       "errors": ["OrderFailure"]
     }
   }
}
