{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Blockcerts Credential schema",
  "description": "Blockcerts 3.0-alpha Credential schema. Implements Verifiable Credential v1.0 schema: https://www.w3.org/TR/vc-data-model/",
  "type": "object",
  "definitions": {
    "JsonLdContext": {
      "description": "A link to a valid JSON-LD context, or array of JSON-LD contexts",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object"
              },
              {
                "type": "array"
              }
            ]
          }
        }
      ]
    },
    "JsonLdType": {
      "description": "A type or an array of types defined in a referenced JSON-LD context.",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      ]
    },
    "DateTime": {
      "description": "Verifiable Credentials must express timestamps as strings compatible with ISO 8601 guidelines, including the time and a time zone indicator. It is recommended to publish all timestamps in UTC. Previous versions of Open Badges allowed Unix timestamps as integers. Open Badges v2.0 requires string ISO 8601 values with time zone indicators. For example, 2016-12-31T23:59:59+00:00 is a valid ISO 8601 timestamp. It contains the year, month, day, T separator, hour number 0-23, minute, optional seconds and decimal microsecond, and a time zone indicator (+/- an offset from UTC or the Z designator for UTC).",
      "type": "string"
    },
    "Issuer": {
      "description": "The value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if dereferenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "object"
        }
      ]
    },
    "MerkleProof2019": {
      "$ref": "https://raw.githubusercontent.com/blockchain-certificates/cert-schema/master/cert_schema/3.0-alpha/merkleProof2019Schema.json",
      "description": "Defined by https://w3c-ccg.github.io/lds-merkle-proof-2019/"
    }
  },
  "properties": {
    "id": {
      "description": "Defined by `id` property in https://www.w3.org/TR/vc-data-model/#identifiers.",
      "type": "string",
      "anyOf": [
        {
          "type": "string",
          "pattern": "^urn:uuid:"
        },
        {
          "type": "string",
          "format": "uri"
        }
      ]
    },
    "type": {
      "$ref": "#/definitions/JsonLdType",
      "description": "Defined by `type` property of https://www.w3.org/TR/vc-data-model/#types"
    },
    "issuer": {
      "$ref": "#/definitions/Issuer",
      "description": "Defined by `issuer` property of https://www.w3.org/TR/vc-data-model/#issuer."
    },
    "issuanceDate": {
      "$ref": "#/definitions/DateTime",
      "description": "Defined by `issuanceDate` property of https://www.w3.org/TR/vc-data-model/#issuance-date."
    },
    "credentialSubject": {
      "type": "object",
      "description": "Defined by `credentialSubject` property of https://www.w3.org/TR/vc-data-model/#credential-subject."
    },
    "proof": {
      "$ref": "#/definitions/MerkleProof2019",
      "description": "Defined by `proof` property of https://www.w3.org/TR/vc-data-model/#proofs-signatures."
    }
  },
  "required": [
    "id",
    "type",
    "issuer",
    "issuanceDate",
    "credentialSubject",
    "proof"
  ],
  "additionalProperties": true
}
