{
  "title": "Test Result Cat ADI3 Schema",
  "type": "object",
  "definitions": {
    "testData": {
      "additionalProperties": false,
      "description": "Data associated with the test",
      "properties": {
        "lessonAndTheme": {
          "$ref": "#/definitions/lessonAndTheme"
        },
        "lessonPlanning": {
          "$ref": "#/definitions/lessonPlanning"
        },
        "riskManagement": {
          "$ref": "#/definitions/riskManagement"
        },
        "teachingLearningStrategies": {
          "$ref": "#/definitions/teachingLearningStrategies"
        },
        "review": {
          "$ref": "#/definitions/review"
        },
        "startTime": {
          "description": "Start time of test",
          "type": "string"
        },
        "endTime": {
          "description": "End time of test",
          "type": "string"
        },
        "totalScore": {
          "description": "Overall score for questions",
          "type": "number"
        }
      }
    },
    "examiner": {
      "$ref": "../common/index.json#/definitions/examiner"
    },
    "testCentre": {
      "$ref": "../common/index.json#/definitions/testCentre"
    },
    "name": {
      "$ref": "../common/index.json#/definitions/name"
    },
    "address": {
      "$ref": "../common/index.json#/definitions/address"
    },
    "candidate": {
      "$ref": "../common/index.json#/definitions/candidate"
    },
    "applicationReference": {
      "$ref": "../common/index.json#/definitions/applicationReference"
    },
    "testSlotAttributes": {
      "$ref": "../common/index.json#/definitions/testSlotAttributes"
    },
    "journalData": {
      "$ref": "../common/index.json#/definitions/journalData"
    },
    "signature": {
      "$ref": "../common/index.json#/definitions/signature"
    },
    "communicationMethod": {
      "$ref": "../common/index.json#/definitions/communicationMethod"
    },
    "conductedLanguage": {
      "$ref": "../common/index.json#/definitions/conductedLanguage"
    },
    "communicationPreferences": {
      "$ref": "../common/index.json#/definitions/communicationPreferences"
    },
    "preTestDeclarations": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "insuranceDeclarationAccepted": {
          "description": "Whether or not the candidate has declared that their test vehicle has a valid insurance policy",
          "type": "boolean"
        },
        "residencyDeclarationAccepted": {
          "description": "Whether or not the candidate has declared that they have lived in the UK for a period acceptable for taking the test",
          "type": "boolean"
        },
        "preTestSignature": {
          "$ref": "#/definitions/signature"
        },
        "validCertificate": {
          "description": "Whether there candidate held/presented a valid certificate",
          "type": "boolean"
        }
      },
      "required": [
        "insuranceDeclarationAccepted",
        "residencyDeclarationAccepted",
        "preTestSignature"
      ]
    },
    "accompaniment": {
      "description": "Indicators for anybody else overseeing the test",
      "type": "object",
      "properties": {
        "supervisor": {
          "description": "Indicates whether a DVSA supervisor was present during the test",
          "type": "boolean"
        },
        "trainer": {
          "description": "Indicates whether a trainer was present during the test",
          "type": "boolean"
        },
        "other": {
          "description": "Indicates whether another type of person was present during the test",
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "question": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "title": {
          "description": "Question title",
          "type": "string"
        },
        "score": {
          "description": "Score given for the question",
          "type": "number"
        }
      }
    },
    "studentLevel": {
      "description": "Question description",
      "type": "string",
      "enum": [
        "beginner",
        "partlyTrained",
        "trained",
        "flhNew",
        "flhExperienced"
      ]
    },
    "lessonTheme": {
      "description": "List of themes for the lesson",
      "type": "string",
      "enum": [
        "junctions",
        "townCityDriving",
        "interactionWithOtherRoadUsers",
        "dualCarriagewayFasterRoads",
        "defensiveDriving",
        "effectiveUseOfMirrors",
        "independentDriving",
        "ruralRoads",
        "motorways",
        "ecoSafeDriving",
        "recapAManoeuvre",
        "commentary",
        "recapEmergencyStop",
        "other"
      ]
    },
    "gearboxCategory": {
      "$ref": "../common/index.json#/definitions/gearboxCategory"
    },
    "postTestDeclarations": {
      "$ref": "../common/index.json#/definitions/postTestDeclarations"
    },
    "testSummary": {
      "description": "Recording of other characteristics of the test",
      "type": "object",
      "properties": {
        "debriefWitnessed": {
          "description": "Indicates whether anybody else (e.g. ADI) was present for the debrief",
          "type": "boolean"
        },
        "D255": {
          "description": "Indicates whether a D255 form needs to be completed",
          "type": "boolean"
        },
        "additionalInformation": {
          "description": "Any comments that the DE wants to record about the test",
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "categoryCode": {
      "$ref": "../common/index.json#/definitions/categoryCode"
    },
    "activityCode": {
      "$ref": "../common/index.json#/definitions/activityCode"
    },
    "gender": {
      "$ref": "../common/index.json#/definitions/gender"
    },
    "rekeyReason": {
      "$ref": "../common/index.json#/definitions/rekeyReason"
    },
    "transfer": {
      "$ref": "../common/index.json#/definitions/transfer"
    },
    "ipadIssue": {
      "$ref": "../common/index.json#/definitions/ipadIssue"
    },
    "other": {
      "$ref": "../common/index.json#/definitions/other"
    },
    "vehicleDetails": {
      "description": "Details about the vehicle to be used for the test",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "registrationNumber": {
          "description": "The vehicle registration number",
          "type": "string",
          "maxLength": 7
        },
        "motStatus": {
          "description": "The mot status of the vehicle",
          "type": "string"
        },
        "motEvidenceProvided": {
          "description": "Marker stating if alternative MOT evidence was provided",
          "type": "boolean"
        },
        "motEvidence": {
          "description": "Alternative MOT evidence",
          "type": "string"
        },
        "make": {
          "description": "The make of the vehicle",
          "type": "string"
        },
        "model": {
          "description": "The model of the vehicle",
          "type": "string"
        },
        "testExpiryDate": {
          "description": "The test expiry date of the vehicle",
          "type": "string"
        },
        "previouslySearchedRegNumbers": {
          "description": "Previously searched for registration numbers",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "gearboxCategory": {
          "$ref": "#/definitions/gearboxCategory"
        },
        "dualControls": {
          "description": "Indicates whether or not the vehicle has dual controls fitted",
          "type": "boolean"
        }
      }
    },
    "trainerDetails": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "orditTrainedCandidate": {
          "description": "Did the candidate receive training from an ORDIT trainer",
          "type": "boolean"
        },
        "pdiLogbook": {
          "description": "Does the PDI have a logbook",
          "type": "boolean"
        },
        "traineeLicence": {
          "description": "Does the trainee have a licence",
          "type": "boolean"
        },
        "trainerRegistrationNumber": {
          "description": "Trainer registration number (PRN)",
          "type": "number",
          "maxLength": 7
        }
      }
    },
    "passCompletion": {
      "description": "Finalisation of a successful test outcome",
      "type": "object",
      "properties": {
        "passCertificateNumber": {
          "description": "The PCN issued to the candidate",
          "type": "string",
          "maxLength": 8,
          "minLength": 8
        }
      },
      "additionalProperties": false
    },
    "businessName": {
      "description": "Name of the business the candidate relates to",
      "type": "string",
      "maxLength": 100
    },
    "businessTelephone": {
      "description": "Telephone number of the business the candidate relates to",
      "type": "string",
      "maxLength": 20
    },
    "lessonAndTheme": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "studentLevel": {
          "$ref": "#/definitions/studentLevel"
        },
        "lessonThemes": {
          "type": "array",
          "description": "List of lesson themes",
          "items": {
            "$ref": "#/definitions/lessonTheme"
          }
        },
        "other": {
          "description": "Other description",
          "type": "string"
        }
      }
    },
    "lessonPlanning": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "q1": {
          "$ref": "#/definitions/question"
        },
        "q2": {
          "$ref": "#/definitions/question"
        },
        "q3": {
          "$ref": "#/definitions/question"
        },
        "q4": {
          "$ref": "#/definitions/question"
        },
        "score": {
          "description": "Overall score for questions",
          "type": "number"
        }
      }
    },
    "riskManagement": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "q1": {
          "$ref": "#/definitions/question"
        },
        "q2": {
          "$ref": "#/definitions/question"
        },
        "q3": {
          "$ref": "#/definitions/question"
        },
        "q4": {
          "$ref": "#/definitions/question"
        },
        "q5": {
          "$ref": "#/definitions/question"
        },
        "score": {
          "description": "Overall score for questions",
          "type": "number"
        }
      }
    },
    "teachingLearningStrategies": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "q1": {
          "$ref": "#/definitions/question"
        },
        "q2": {
          "$ref": "#/definitions/question"
        },
        "q3": {
          "$ref": "#/definitions/question"
        },
        "q4": {
          "$ref": "#/definitions/question"
        },
        "q5": {
          "$ref": "#/definitions/question"
        },
        "q6": {
          "$ref": "#/definitions/question"
        },
        "q7": {
          "$ref": "#/definitions/question"
        },
        "q8": {
          "$ref": "#/definitions/question"
        },
        "score": {
          "description": "Overall score for questions",
          "type": "number"
        }
      }
    },
    "review": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "immediateDanger": {
          "description": "Whether at any point there was an incident/behavior that put someone in potential danger",
          "type": "boolean"
        },
        "seekFurtherDevelopment": {
          "description": "Whether advice was given to seek further development to the candidate",
          "type": "boolean"
        },
        "reasonForNoAdviceGiven": {
          "description": "Reason for no advice given to candidate",
          "type": "string"
        },
        "feedback": {
          "description": "Feedback offered to candidate",
          "type": "string"
        },
        "grade": {
          "description": "ADI3 have different levels of passes represented in grade form",
          "type": "string"
        }
      }
    }
  },
  "properties": {
    "version": {
      "description": "Version number",
      "type": "string"
    },
    "appVersion": {
      "description": "App version number",
      "type": "string"
    },
    "category": {
      "$ref": "#/definitions/categoryCode"
    },
    "journalData": {
      "$ref": "#/definitions/journalData"
    },
    "activityCode": {
      "$ref": "#/definitions/activityCode"
    },
    "communicationPreferences": {
      "$ref": "#/definitions/communicationPreferences"
    },
    "preTestDeclarations": {
      "$ref": "#/definitions/preTestDeclarations"
    },
    "accompaniment": {
      "$ref": "#/definitions/accompaniment"
    },
    "postTestDeclarations": {
      "$ref": "#/definitions/postTestDeclarations"
    },
    "testSummary": {
      "$ref": "#/definitions/testSummary"
    },
    "rekeyReason": {
      "$ref": "#/definitions/rekeyReason"
    },
    "rekey": {
      "description": "Whether the test was rekeyed or not",
      "type": "boolean"
    },
    "rekeyDate": {
      "description": "Date the test was rekeyed",
      "type": "string"
    },
    "delegatedTest": {
      "description": "Whether the test was completed by a delegated examiner or not",
      "type": "boolean"
    },
    "changeMarker": {
      "description": "Whether the test was conducted by another examiner",
      "type": "boolean"
    },
    "examinerBooked": {
      "description": "The examiner who the test was booked to",
      "type": [
        "number",
        "string"
      ]
    },
    "examinerConducted": {
      "description": "The examiner who conducted the test",
      "type": [
        "number",
        "string"
      ]
    },
    "examinerKeyed": {
      "description": "The examiner who keyed the test into the iPad",
      "type": "number"
    },
    "passCompletion": {
      "$ref": "#/definitions/passCompletion"
    },
    "vehicleDetails": {
      "$ref": "#/definitions/vehicleDetails"
    },
    "trainerDetails": {
      "$ref": "#/definitions/trainerDetails"
    },
    "userExitedApp": {
      "$ref": "../common/index.json#/definitions/userExitedApp"
    },
    "testData": {
      "$ref": "#/definitions/testData"
    }
  },
  "additionalProperties": false,
  "required": [
    "version",
    "category",
    "journalData",
    "activityCode",
    "rekey",
    "changeMarker",
    "examinerBooked",
    "examinerConducted",
    "examinerKeyed",
    "journalData"
  ]
}

