{
  "@context": {
    "ixo": "https://w3id.org/ixo/ns/protocol/",
    "@id": "@type",
    "type": "@type",
    "@protected": true
  },
  "type": "ixo:entity#surveyTemplate",
  "question": {
    "title": "Delivery Claim",
    "description": "Record what you delivered to a customer. A red star * means you must answer.",
    "pages": [
      {
        "name": "delivery_customer",
        "elements": [
          {
            "type": "text",
            "name": "ecs:customerId",
            "title": "SupaMoto customer ID",
            "isRequired": true
          }
        ],
        "title": "Who did you deliver to?"
      },
      {
        "name": "delivery_items",
        "elements": [
          {
            "type": "paneldynamic",
            "name": "schema:orderedItem",
            "title": "Items delivered",
            "isRequired": true,
            "templateElements": [
              {
                "type": "radiogroup",
                "name": "ecs:itemCategory",
                "title": "What kind of item is this?",
                "isRequired": true,
                "choices": [
                  {
                    "value": "pellets",
                    "text": "Pellets (fuel)"
                  },
                  {
                    "value": "stove",
                    "text": "Stove"
                  },
                  {
                    "value": "accessory",
                    "text": "Accessory"
                  }
                ]
              },
              {
                "type": "text",
                "name": "ecs:batchID",
                "visibleIf": "{panel.ecs:itemCategory} = 'pellets'",
                "title": "Pellet batch ID",
                "description": "Printed on the bag or on the batch sheet.",
                "isRequired": true
              },
              {
                "type": "dropdown",
                "name": "schema:weight",
                "visibleIf": "{panel.ecs:itemCategory} = 'pellets'",
                "title": "Weight of each bag",
                "isRequired": true,
                "choices": [
                  "1kg",
                  "5kg",
                  "30kg",
                  "50kg"
                ],
                "showOtherItem": true,
                "otherText": "Other weight"
              },
              {
                "type": "text",
                "name": "ecs:stoveSerialNumber",
                "visibleIf": "{panel.ecs:itemCategory} = 'stove'",
                "title": "Stove serial number",
                "description": "The long number on the sticker under the stove.",
                "isRequired": true
              },
              {
                "type": "dropdown",
                "name": "ecs:accessoryType",
                "visibleIf": "{panel.ecs:itemCategory} = 'accessory'",
                "title": "Which accessory?",
                "isRequired": true,
                "choices": [
                  "Battery",
                  "Charging cable",
                  "Fan unit",
                  "Cooking pot",
                  "Spare part"
                ],
                "showOtherItem": true,
                "otherText": "Other accessory"
              },
              {
                "type": "text",
                "name": "schema:serialNumber",
                "visibleIf": "{panel.ecs:itemCategory} = 'accessory'",
                "title": "Accessory ID or serial number",
                "description": "Write the number on the item or its box. If there is no number, write 'None'.",
                "isRequired": true
              }
            ],
            "panelCount": 1,
            "minPanelCount": 1,
            "maxPanelCount": 20,
            "addPanelText": "Add another item",
            "removePanelText": "Remove this item"
          },
          {
            "type": "comment",
            "name": "schema:description",
            "title": "Anything we should know? (optional)",
            "description": "For example: a bag was damaged, or the customer was not at home.",
            "rows": 3
          }
        ],
        "title": "What did you deliver?",
        "description": "Add one block for each item. Tap 'Add another item' if you delivered more than one thing."
      },
      {
        "name": "delivery_confirmation",
        "elements": [
          {
            "type": "html",
            "name": "ixo:instruction",
            "html": "<p>Ask the customer for the <strong>4-digit PIN</strong> they got on their phone. Type it in below. This proves they received the delivery.</p>"
          },
          {
            "type": "text",
            "name": "ixo:oneTimePin",
            "title": "Customer's ONE TIME PIN",
            "description": "The customer will provide you a OTP, input it here",
            "isRequired": true,
            "inputType": "number",
            "maxLength": 4
          }
        ],
        "title": "Confirm with the customer"
      }
    ],
    "questionErrorLocation": "bottom",
    "showProgressBar": true,
    "progressBarLocation": "top",
    "pagePrevText": "Back",
    "pageNextText": "Next",
    "completeText": "Submit delivery claim",
    "showPreviewBeforeComplete": true
  }
}