{
  "title": "Course completion",
  "$id": "https://velocitynetwork.foundation/schemas/course-completion-v1.1",
  "allOf": [
    {
      "$ref": "#/definitions/Course-base_Schema"
    },
    {
      "type": "object",
      "properties": {
        "grade": {
          "$ref": "#/definitions/Score_Schema"
        },
        "registrationDate": {
          "$ref": "#/definitions/Date_Schema"
        },
        "startDate": {
          "$ref": "#/definitions/Date_Schema"
        },
        "completionDate": {
          "$ref": "#/definitions/Date_Schema"
        }
      }
    }
  ],
  "required": [
    "provider",
    "courseName",
    "completionDate",
    "recipient"
  ],
  "definitions": {
    "Course-base_Schema": {
      "title": "Course-base",
      "type": "object",
      "properties": {
        "@context": {
          "$ref": "#/definitions/Json-ld-context_Schema"
        },
        "type": {
          "type": "string",
          "default": "Course"
        },
        "provider": {
          "$ref": "#/definitions/Organization_Schema"
        },
        "contentProvider": {
          "$ref": "#/definitions/Organization_Schema"
        },
        "courseName": {
          "type": "string",
          "description": "The name of the course.",
          "maxLength": 256
        },
        "description": {
          "type": "string",
          "description": "A detailed description of the course. ",
          "maxLength": 2048
        },
        "courseCode": {
          "type": "string",
          "description": "The code of the course as it appears in the provider's records.",
          "maxLength": 256
        },
        "courseType": {
          "type": "string",
          "description": "The type of course, e.g., professional training, preparation for a license exam, academic course, etc.",
          "maxLength": 256
        },
        "courseMode": {
          "type": "string",
          "description": "The course mode or method of teaching, e.g. online, instructor led, lecture, workshop, etc. ",
          "maxLength": 256
        },
        "courseLevel": {
          "type": "string",
          "description": "The level of the course, e.g., standard, basic, advanced, etc. ",
          "maxLength": 64
        },
        "courseDuration": {
          "type": "string",
          "format": "duration",
          "description": "The duration of the course in ISO 8601 Duration format. See https://en.wikipedia.org/wiki/ISO_8601#Durations"
        },
        "recipient": {
          "$ref": "#/definitions/PersonName_Schema"
        },
        "alignment": {
          "type": "array",
          "description": "A public resource to which the course is aligned.",
          "minItems": 1,
          "items": {
            "$ref": "#/definitions/Alignment_Schema"
          }
        }
      }
    },
    "Json-ld-context_Schema": {
      "title": "json-ld-context",
      "oneOf": [
        {
          "type": "string",
          "maxLength": 2048
        },
        {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "maxLength": 2048
          }
        }
      ],
      "description": "Simplified context for Velocity Publishers to Use"
    },
    "Alignment_Schema": {
      "title": "Alignment",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "default": "AlignmentObject"
        },
        "targetName": {
          "type": "string",
          "description": "Name of the target alignment.",
          "maxLength": 256
        },
        "targetUrl": {
          "type": "string",
          "format": "uri",
          "description": "URL of the target alignment. ",
          "maxLength": 2048
        },
        "targetDescription": {
          "type": "string",
          "description": "Detailed description of the target alignment. ",
          "maxLength": 2048
        },
        "targetCode": {
          "type": "string",
          "description": "Code of the target alignment. ",
          "maxLength": 256
        },
        "targetFramework": {
          "type": "string",
          "description": "The framework to which the target belongs. ",
          "maxLength": 256
        }
      },
      "required": [
        "targetName",
        "targetUrl"
      ]
    },
    "Date_Schema": {
      "title": "Calendar date",
      "type": "string",
      "pattern": "^[1,2]\\d\\d\\d(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\\d|30|31))?)?$",
      "description": ""
    },
    "Did_Schema": {
      "title": "DID",
      "type": "string",
      "pattern": "^did:[a-z0-9]+:[A-Za-z0-9._:?=&%;-]+$"
    },
    "Organization_Schema": {
      "title": "Organization",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "default": "Organization"
        },
        "name": {
          "type": "string",
          "description": "The name of the organization.",
          "maxLength": 256
        },
        "identifier": {
          "$ref": "#/definitions/Did_Schema"
        },
        "place": {
          "$ref": "#/definitions/Place_Schema"
        },
        "image": {
          "type": "string",
          "maxLength": 2048,
          "format": "uri",
          "description": "IRI representing the logo of the organization. This must be JPG, PNG or SVG file. \nFor PNG or JPG: 300px x 300px minimum, maximum size 500kb. "
        }
      },
      "required": [
        "name",
        "place"
      ]
    },
    "PersonName_Schema": {
      "title": "Person name",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "default": "PersonName"
        },
        "givenName": {
          "type": "string",
          "description": "The given name or first name of the person.",
          "maxLength": 64
        },
        "familyName": {
          "type": "string",
          "description": "The family name or surname of the person.",
          "maxLength": 64
        },
        "middleName": {
          "type": "string",
          "description": "The middle name of the person.",
          "maxLength": 256
        },
        "namePrefix": {
          "type": "string",
          "description": "A prefix to the name such as Dr or Sir.",
          "maxLength": 8
        },
        "nameSuffix": {
          "type": "string",
          "description": "A suffix to the name such as Jr. or Sr.",
          "maxLength": 16
        }
      },
      "required": [
        "givenName",
        "familyName"
      ]
    },
    "Place_Schema": {
      "title": "Place",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "default": "Place"
        },
        "name": {
          "type": "string",
          "description": "The name of the place, e.g., building name, branch name, etc.",
          "maxLength": 256
        },
        "addressLocality": {
          "type": "string",
          "description": "The locality where the place is, e.g., town or city name.",
          "maxLength": 256
        },
        "addressRegion": {
          "type": "string",
          "pattern": "^[A-Z]{2}(-[A-Z0-9]{1,3})?$",
          "description": "The region where the place is. These are states, provinces, etc. Must be an [ISO 3166-2 subdivision code](https://en.wikipedia.org/wiki/ISO_3166-2)",
          "maxLength": 6
        },
        "addressCountry": {
          "type": "string",
          "description": "The country where the place is. Must be an [ISO 3166 2 letter country code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes)",
          "pattern": "^[A-Z]{2}$",
          "maxLength": 2
        }
      },
      "required": [
        "addressCountry"
      ]
    },
    "Score_Schema": {
      "title": "Score",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "scoreMethod": {
          "type": "object",
          "description": "The method according to which the score is given. ",
          "additionalProperties": false,
          "properties": {
            "type": {
              "type": "string",
              "default": "ScoreMethod"
            },
            "scoreMethodType": {
              "type": "string",
              "enum": [
                "NormReferenced",
                "CriterionReferenced"
              ],
              "description": "One of: NormReferenced, CriterionReferenced."
            },
            "alignment": {
              "type": "array",
              "description": "A public resource to which the scoring method is aligned.",
              "minItems": 1,
              "items": {
                "$ref": "#/definitions/Alignment_Schema"
              }
            },
            "scoreMethodDescription": {
              "type": "string",
              "description": "A description of the scoring method used.",
              "maxLength": 2048
            },
            "passingScore": {
              "type": "string",
              "description": "The minimum passing score",
              "maxLength": 16
            }
          }
        },
        "type": {
          "type": "string",
          "default": "Score"
        },
        "scoreValue": {
          "type": "string",
          "description": "The score achieved by the person.",
          "maxLength": 16
        },
        "result": {
          "type": "string",
          "description": "The result achieved by the person, e.g. acceptable, excellent, poor. Applicable when results are not stated as scores. ",
          "maxLength": 2048
        },
        "passFail": {
          "type": "string",
          "enum": [
            "Pass",
            "Fail"
          ],
          "description": "One of: Pass, Fail"
        },
        "scoreDescription": {
          "type": "string",
          "description": "Explanation or description of the meaning of the score and/or result achieved.",
          "maxLength": 2048
        }
      },
      "description": ""
    }
  }
}