{
  "@context": {
    "ixo": "https://w3id.org/ixo/ns/protocol/",
    "@id": "@type",
    "type": "@type",
    "@protected": true
  },
  "type": "ixo:entity#surveyTemplate",
  "question": {
    "title": "SupaMoto Agent & Operator Registration",
    "pages": [
      {
        "name": "registration",
        "elements": [
          {
            "type": "text",
            "name": "schema:givenName",
            "title": "Name",
            "isRequired": true
          },
          {
            "type": "text",
            "name": "schema:familyName",
            "title": "Surname",
            "isRequired": true
          },
          {
            "type": "text",
            "name": "schema:email",
            "title": "Email",
            "validators": [
              {
                "type": "email",
                "text": "Please enter a valid email address."
              }
            ],
            "inputType": "email"
          },
          {
            "type": "text",
            "name": "schema:telephone",
            "title": "Phone number",
            "isRequired": true,
            "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": "person:nationalId",
            "title": "National Registration Number",
            "isRequired": true,
            "validators": [
              {
                "type": "regex",
                "text": "Use the format xxxxxx/xx/x",
                "regex": "^\\d{6}/\\d{2}/\\d{1}$"
              }
            ]
          }
        ],
        "title": "Agent Information"
      },
      {
        "name": "page1",
        "elements": [
          {
            "type": "radiogroup",
            "name": "ecs:register",
            "title": "Do you want to:",
            "isRequired": true,
            "choices": [
              {
                "value": "ecs:joinSupaPartner",
                "text": "Register as part of an existing Supa Operator"
              },
              {
                "value": "ecs:registerSupaPartner",
                "text": "Register a new Supa Operator"
              }
            ]
          },
          {
            "type": "dropdown",
            "name": "ecs:role",
            "visibleIf": "{ecs:register} = 'ecs:registerSupaPartner'",
            "title": "Role",
            "isRequired": true,
            "choices": [
              "Stove Minter",
              "Factory",
              "Warehouse",
              "Area Circle",
              { "value": "Supa Partner", "text": "Supa Operator" }
            ]
          },
          {
            "type": "text",
            "name": "schema:alternateName",
            "visibleIf": "{ecs:register} = 'ecs:registerSupaPartner'",
            "title": "Business/Operation Name",
            "description": "e.g. 'Lusaka Pellet Works' (Factory), 'Town Warehouse' (Depot), 'Lusaka West Area Circle' (Area Circle), 'Mary's Supa Shop' (Supa Operator)",
            "isRequired": true
          },
          {
            "type": "text",
            "name": "schema:supaPartnerName",
            "visibleIf": "{ecs:register} = 'ecs:joinSupaPartner'",
            "title": "Business/Operation Name",
            "description": "What existing Supa Operator are you joining?",
            "isRequired": true
          },
          {
            "type": "text",
            "name": "ecs:areaCircle",
            "visibleIf": "{ecs:role} = 'Supa Partner' and {ecs:register} = 'ecs:registerSupaPartner'",
            "title": "Area Circle",
            "description": "Which Area Circle do you fall under?",
            "isRequired": true
          },
          {
            "type": "text",
            "name": "ecs:supaPartnerDid",
            "visible": false,
            "title": "Supa Operator Entity Did"
          },
          {
            "type": "map-grid-selector",
            "name": "ixo:geoLocation",
            "visibleIf": "{ecs:register} = 'ecs:registerSupaPartner'",
            "title": "Primary Operating Location",
            "description": "The primary location where activities are conducted/based from.\nThe map will default to your current location, zoom in until you see the grid on the map, select the cell that represents the primary location",
            "isRequired": true,
            "center": "-15.408352478000213, 28.28021546503468"
          }
        ],
        "title": "Supa Operator Details"
      },
      {
        "name": "reviewAndSubmit",
        "elements": [
          {
            "type": "html",
            "name": "reviewMessage",
            "html": "<h3>Thank you for completing the registration!</h3><p>Please review your answers below before submitting.</p>"
          }
        ],
        "title": "Thank You"
      }
    ],
    "checkErrorsMode": "onValueChanged",
    "validateVisitedEmptyFields": true,
    "textUpdateMode": "onTyping",
    "showPreviewBeforeComplete": true
  }
}
