{
  "title": "License",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://velocitynetwork.foundation/schemas/license",
  "allOf": [
    {
      "title": "certification-license-descriptor",
      "$schema": "http://json-schema.org/draft-07/schema#",
      "allOf": [
        {
          "$ref": "#/definitions/Json-ld-context_Schema"
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "CertificationLicense"
            },
            "authority": {
              "$ref": "#/definitions/Organization_Schema"
            },
            "name": {
              "type": "string",
              "description": "The name of the certification or license. "
            },
            "description": {
              "type": "string",
              "description": "Detailed description of the certification or license. "
            },
            "alignment": {
              "type": "array",
              "description": "A public resource to which the certification or license is aligned.",
              "minItems": 1,
              "items": {
                "$ref": "#/definitions/Alignment_Schema"
              }
            }
          }
        }
      ]
    },
    {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "default": "CertificationLicense"
        },
        "identifier": {
          "type": "string",
          "description": "The number or other unique identifier of the license held by the person. "
        },
        "validity": {
          "$ref": "#/definitions/Validity_Schema"
        },
        "endorsementCode": {
          "type": "array",
          "description": "Endorsements to the license such as vehicle class A1, B, in driver's license, or specialties in nursing license.",
          "minItems": 1,
          "items": {
            "type": "string"
          }
        },
        "restrictionCode": {
          "type": "array",
          "description": "Restrictions to the license such as need to wear glasses in driver's license.",
          "minItems": 1,
          "items": {
            "type": "string"
          }
        }
      }
    }
  ],
  "definitions": {
    "Json-ld-context_Schema": {
      "title": "json-ld-context",
      "type": "object",
      "properties": {
        "@context": {
          "oneOf": [
            {
              "type": "string",
              "properties": {}
            },
            {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string"
              }
            }
          ]
        }
      },
      "description": "Simplified context for Velocity Publishers to Use"
    },
    "Alignment_Schema": {
      "title": "alignment.schema",
      "allOf": [
        {
          "$ref": "#/definitions/Json-ld-context_Schema"
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "AlignmentObject"
            },
            "targetName": {
              "type": "string",
              "description": "Name of the target alignment."
            },
            "targetUrl": {
              "type": "string",
              "format": "uri",
              "description": "URL of the target alignment. "
            },
            "targetDescription": {
              "type": "string",
              "description": "Detailed description of the target alignment. "
            },
            "targetCode": {
              "type": "string",
              "description": "Code of the target alignment. "
            },
            "targetFramework": {
              "type": "string",
              "description": "The framework to which the target belongs. "
            }
          }
        }
      ],
      "required": [
        "targetName",
        "targetUrl"
      ]
    },
    "Organization_Schema": {
      "title": "organization.schema",
      "allOf": [
        {
          "$ref": "#/definitions/Json-ld-context_Schema"
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Organization"
            },
            "name": {
              "type": "string",
              "description": "The name of the organization."
            },
            "identifier": {
              "type": "string",
              "title": "did.schema",
              "pattern": "^did:[a-z0-9]+:[A-Za-z0-9._:?=&%;-]+$"
            },
            "place": {
              "$ref": "#/definitions/Place_Schema"
            }
          }
        }
      ],
      "required": [
        "name",
        "place"
      ]
    },
    "Place_Schema": {
      "title": "place.schema",
      "allOf": [
        {
          "$ref": "#/definitions/Json-ld-context_Schema"
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Place"
            },
            "name": {
              "type": "string",
              "description": "The name of the place, e.g., building name, branch name, etc."
            },
            "addressLocality": {
              "type": "string",
              "description": "The locality where the place is, e.g., town or city name. "
            },
            "addressRegion": {
              "type": "string",
              "pattern": "^[A-Z]{2}(-[A-Z0-9]{1,3})?$",
              "description": "The region where the place is. For the US regions are states. "
            },
            "addressCountry": {
              "type": "string",
              "description": "The country where the place is. "
            }
          }
        }
      ],
      "required": [
        "addressCountry"
      ]
    },
    "Validity_Schema": {
      "title": "validity.schema",
      "allOf": [
        {
          "$ref": "#/definitions/Json-ld-context_Schema"
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Validity"
            },
            "firstValidFrom": {
              "type": "string",
              "format": "date",
              "description": "The original date from which a certification, document or license is valid. "
            },
            "validFrom": {
              "oneOf": [
                {
                  "format": "date"
                },
                {
                  "format": "date-time"
                }
              ],
              "description": "The date from which a certification, document or license is valid. In case of renewal, validFrom date will state the date or renewal. ",
              "type": "string"
            },
            "validUntil": {
              "oneOf": [
                {
                  "format": "date"
                },
                {
                  "format": "date-time"
                }
              ],
              "description": "The date until which a certification, document or license is valid. ",
              "type": "string"
            },
            "validIn": {
              "$ref": "#/definitions/Place_Schema"
            }
          }
        }
      ]
    }
  }
}