{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "description": "Badge",
  "$id": "badge",
  "type": "object",
  "definitions": {
    "DID": {
      "type": "string",
      "pattern": "^did:[a-z0-9]+:[A-Za-z0-9._:?=&%;-]+$"
    },
    "obiAlignment": {
      "type": "object",
      "properties": {
        "targetName": {
          "type": "string",
          "description": "CCSS.ELA-Literacy.RST.11-12.3"
        },
        "targetUrl": {
          "type": "string",
          "format": "uri",
          "description": "http://www.corestandards.org/ELA-Literacy/RST/11-12/3"
        },
        "targetDescription": {
          "type": "string",
          "description": "A description of the ELA ltieracy certification."
        },
        "targetCode": {
          "type": "string",
          "description": "CCSS.ELA-Literacy.RST.11-12.3"
        },
        "targetFramework": {
          "type": "string",
          "description": "Mozilla 21st Century Skills"
        }
      },
      "required": [
        "targetName",
        "targetUrl"
      ],
      "additionalProperties": false
    },
    "obiProfile": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "description": "https://example.com/profiles/alice"
        },
        "type": {
          "type": "string",
          "enum": [
            "Profile",
            "Issuer"
          ]
        },
        "name": {
          "type": "string",
          "description": "Example Issuer"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "http://example.com"
        },
        "email": {
          "type": "string",
          "format": "email",
          "description": "test@example.com"
        },
        "image": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false
    }
  },
  "properties": {
    "holds": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uri"
        },
        "type": {
          "type": "string"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9\\s]*$",
          "maxLength": 64
        },
        "description": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9\\s]*$",
          "maxLength": 64
        },
        "image": {
          "type": "string",
          "format": "uri"
        },
        "criteria": {
          "type": "string",
          "description": "https://example.org/robotics-badge.html",
          "pattern": "^[a-zA-Z0-9\\s]*$",
          "maxLength": 64
        },
        "issuer": {
          "oneOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "$ref": "#/definitions/obiProfile"
            }
          ]
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "alignment": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/obiAlignment"
          }
        }
      },
      "required": [
        "type",
        "name",
        "description",
        "image",
        "criteria",
        "issuer"
      ]
    }
  },
  "required": [
    "holds"
  ],
  "additionalProperties": false
}