{
  "@context": {
    "ixo": "https://w3id.org/ixo/ns/protocol/",
    "@id": "@type",
    "type": "@type",
    "@protected": true
  },
  "type": "ixo:entity#surveyTemplate",
  "question": {
    "title": "SupaMoto Customer Update",
    "description": "Update the details of an existing SupaMoto customer. Only the Customer ID is required - fill in only the fields that are changing.",
    "pages": [
      {
        "name": "update",
        "elements": [
          {
            "type": "text",
            "name": "ecs:customerId",
            "title": "Customer ID",
            "description": "The SupaMoto Customer ID (e.g. C21009802).",
            "isRequired": true
          },
          {
            "type": "dropdown",
            "name": "ecs:clientType",
            "title": "Client Group Type",
            "choices": [
              "Utility",
              "Utility-Staff",
              "Non-Utility",
              "Non-Utility Staff",
              "Organisation",
              "Retired",
              "Unregistered",
              "Reseller",
              "Test"
            ],
            "showOtherItem": true
          },
          {
            "type": "text",
            "name": "schema:givenName",
            "title": "First Name",
            "validators": [
              {
                "type": "regex",
                "regex": "^[A-Za-z ]+$"
              }
            ]
          },
          {
            "type": "text",
            "name": "schema:familyName",
            "title": "Last Name",
            "validators": [
              {
                "type": "regex",
                "regex": "^[A-Za-z ]+$"
              }
            ]
          },
          {
            "type": "text",
            "name": "person:nationalId",
            "title": "National Registration Number",
            "description": "Shown for reference only - the National Registration Number cannot be changed by an update.",
            "readOnly": true,
            "validators": [
              {
                "type": "regex",
                "text": "Use the format xxxxxx/xx/x",
                "regex": "^\\d{6}/\\d{2}/\\d{1}$"
              }
            ],
            "placeholder": "xxxxxx/xx/x"
          },
          {
            "type": "text",
            "name": "schema:telephone",
            "title": "Contact number",
            "validators": [
              {
                "type": "regex",
                "text": "Please enter the phone number in international format, including the country code (e.g. +260977123456).",
                "regex": "^\\+[1-9]\\d{6,14}$"
              }
            ],
            "inputType": "tel"
          },
          {
            "type": "text",
            "name": "schema:telephone_2",
            "title": "Alternative Contact number",
            "validators": [
              {
                "type": "regex",
                "text": "Please enter the phone number in international format, including the country code (e.g. +260977123456).",
                "regex": "^\\+[1-9]\\d{6,14}$"
              }
            ],
            "inputType": "tel"
          },
          {
            "type": "radiogroup",
            "name": "schema:DeliveryMethod",
            "title": "How would you prefer to get your pellet bag?",
            "choices": [
              {
                "value": "Collect from neighbor",
                "text": "Lead Generator (Neighbor) pickup"
              },
              {
                "value": "Shop Pickup",
                "text": "SupaMoto Shop pickup"
              },
              "Home Delivery"
            ]
          },
          {
            "type": "file",
            "name": "schema:profileImage",
            "title": "Profile Image",
            "acceptedTypes": "image/jpeg, image/png",
            "waitForUpload": true,
            "maxSize": 10000000,
            "sourceType": "file-camera"
          },
          {
            "type": "panel",
            "name": "addressAndLocation",
            "title": "Address",
            "description": "Only relevant to leads who have not had a home visit. Where a home visit has already taken place, the address captured there is the record - leave these fields blank.",
            "elements": [
              {
                "type": "dropdown",
                "name": "schema:addressCountry",
                "title": "Country",
                "choices": [
                  {
                    "value": "ZM",
                    "text": "Zambia"
                  },
                  {
                    "value": "MW",
                    "text": "Malawi"
                  }
                ],
                "showOtherItem": true
              },
              {
                "type": "text",
                "name": "schema:postalAddress",
                "title": "Address"
              }
            ]
          }
        ],
        "title": "Customer Details to Update"
      },
      {
        "name": "reviewAndSubmit",
        "elements": [
          {
            "type": "html",
            "name": "reviewMessage",
            "html": "<h3>Thank you for updating these customer details!</h3><p>Please review your answers below before submitting.</p>"
          }
        ],
        "title": "Thank You"
      }
    ],
    "checkErrorsMode": "onValueChanged",
    "validateVisitedEmptyFields": true,
    "textUpdateMode": "onTyping",
    "showPreviewBeforeComplete": true
  }
}
