{
  "$schema": "https://json-schema.org/draft/2019-09/schema#",
  "$id": "http://purl.imsglobal.org/spec/ob-accred/v2p0/schema",
  "type": "object",
  "properties": {
    "issuer": {
      "type": "object",
      "properties": {
        "accreditations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Accreditation"
          }
        }
      },
      "required": ["accreditations"],
      "additionalProperties": true
    }
  },
  "additionalProperties": true,
  "$defs": {
    "ISODate": {
      "description": "ISO 8601 date format string YYYY-MM-DD or YYYYMMDD",
      "type": "string",
      "pattern": "^([0-9]{4})(-?)(1[0-2]|0[1-9])\\2(3[01]|0[1-9]|[12][0-9])$"
    },
    "Accreditation": {
      "type": "object",
      "properties": {
        "contactInstructions": {
          "type": "string"
        },
        "logo": {
          "type": "string",
          "format": "uri"
        },
        "areaServed": {
          "type": "string"
        },
        "accreditationDate": {
          "$ref": "#/$defs/ISODate"
        },
        "educationalSector": {
          "type": "string"
        }
      },
      "required": ["contactInstructions"]
    }
  }
}
