{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "release",
    "authorities",
    "scopes",
    "sources",
    "subjects",
    "claims",
    "advisories",
    "changes",
    "research"
  ],
  "properties": {
    "release": {
      "$ref": "#/definitions/release"
    },
    "authorities": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/authority"
      },
      "minItems": 0
    },
    "scopes": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/scope"
      },
      "minItems": 0
    },
    "sources": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/source"
      },
      "minItems": 0
    },
    "subjects": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/subject"
      },
      "minItems": 0
    },
    "claims": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/claim"
      },
      "minItems": 0
    },
    "advisories": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/advisory"
      },
      "minItems": 0
    },
    "changes": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/change"
      },
      "minItems": 0
    },
    "research": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/research"
      },
      "minItems": 40
    }
  },
  "definitions": {
    "release": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema_version",
        "dataset_version",
        "released_at",
        "default_review_days"
      ],
      "properties": {
        "schema_version": {
          "const": "1.0.0"
        },
        "dataset_version": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}\\.\\d+$"
        },
        "released_at": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "default_review_days": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "authority": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "jurisdiction",
        "type",
        "url"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "jurisdiction": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "enum": [
            "standards_body",
            "government_agency",
            "executive",
            "government_body",
            "research_body",
            "registry",
            "implementer"
          ]
        },
        "url": {
          "type": "string",
          "pattern": "^https://"
        }
      }
    },
    "scope": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "jurisdiction",
        "system_category"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
        },
        "jurisdiction": {
          "type": "string",
          "minLength": 1
        },
        "system_category": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "issuers",
        "title",
        "designation",
        "edition",
        "published",
        "status",
        "classification",
        "url",
        "locator",
        "retrieved_at",
        "supersedes"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
        },
        "issuers": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "designation": {
          "type": "string",
          "minLength": 1
        },
        "edition": {
          "type": "string",
          "minLength": 1
        },
        "published": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
            },
            {
              "type": "null"
            }
          ]
        },
        "status": {
          "enum": [
            "final",
            "superseded",
            "draft",
            "issued",
            "adopted",
            "proposed",
            "maintained",
            "withdrawn"
          ]
        },
        "classification": {
          "enum": [
            "primary_document",
            "official_tracker",
            "official_guidance",
            "implementation",
            "official_registry"
          ]
        },
        "url": {
          "type": "string",
          "pattern": "^https://"
        },
        "locator": {
          "type": "string",
          "minLength": 1
        },
        "retrieved_at": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "supersedes": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "subject": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "kind",
        "aliases",
        "roles",
        "sources"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "kind": {
          "enum": [
            "algorithm",
            "variant",
            "protocol",
            "construction",
            "program"
          ]
        },
        "aliases": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "roles": {
          "type": "array",
          "items": {
            "enum": [
              "sign",
              "verify",
              "key_establishment",
              "encrypt",
              "decrypt",
              "hashing",
              "planning",
              "procurement",
              "digital_signatures",
              "issue_certificate",
              "protocol_support",
              "legacy"
            ]
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "basis": {
          "type": "string",
          "minLength": 1
        },
        "parent": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
        },
        "parameters": {
          "type": "object",
          "minProperties": 1,
          "propertyNames": {
            "pattern": "^[a-z][a-z0-9_]*$"
          },
          "additionalProperties": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "integer",
                "minimum": 1
              }
            ]
          }
        },
        "version": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "components": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
          },
          "minItems": 2,
          "uniqueItems": true
        },
        "protocol": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
        },
        "composition": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "evidence": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "source_id",
        "locator"
      ],
      "properties": {
        "source_id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
        },
        "locator": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "effective": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "value",
        "precision",
        "boundary",
        "kind",
        "expression",
        "end"
      ],
      "properties": {
        "value": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
            },
            {
              "type": "null"
            }
          ]
        },
        "precision": {
          "enum": [
            "day",
            "month",
            "year",
            "relative",
            "unknown"
          ]
        },
        "boundary": {
          "enum": [
            "after",
            "on",
            "on_or_after",
            "by",
            "within",
            "unspecified"
          ]
        },
        "kind": {
          "enum": [
            "schedule",
            "hard_deadline",
            "target",
            "publication",
            "effective_date",
            "unknown"
          ]
        },
        "expression": {
          "type": "string",
          "minLength": 1
        },
        "end": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "value",
                "boundary"
              ],
              "properties": {
                "value": {
                  "type": "string",
                  "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
                },
                "boundary": {
                  "enum": [
                    "before",
                    "through"
                  ]
                }
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "relative_to": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "offset_days": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "conditions": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "note",
        "manual_review",
        "predicates"
      ],
      "properties": {
        "note": {
          "type": "string",
          "minLength": 1
        },
        "manual_review": {
          "type": "boolean"
        },
        "predicates": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "field",
              "equals"
            ],
            "properties": {
              "field": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]*$"
              },
              "equals": {
                "type": "string",
                "minLength": 1
              }
            }
          },
          "minItems": 0,
          "uniqueItems": true
        }
      }
    },
    "claim": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "revision",
        "previous_revision",
        "subject_id",
        "authority_id",
        "scope_id",
        "use",
        "kind",
        "status",
        "normative_force",
        "summary",
        "effective",
        "conditions",
        "evidence",
        "confidence",
        "publication_state",
        "last_verified_at",
        "review_method",
        "review_interval_days"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
        },
        "revision": {
          "type": "integer",
          "minimum": 1
        },
        "previous_revision": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "subject_id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
        },
        "authority_id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
        },
        "scope_id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
        },
        "use": {
          "enum": [
            "sign",
            "verify",
            "key_establishment",
            "encrypt",
            "decrypt",
            "hashing",
            "planning",
            "procurement",
            "digital_signatures",
            "issue_certificate",
            "protocol_support",
            "legacy"
          ]
        },
        "kind": {
          "enum": [
            "lifecycle_status",
            "migration_milestone",
            "parameter_requirement",
            "implementation_support",
            "standardization",
            "replacement_guidance",
            "theoretical_exposure"
          ]
        },
        "status": {
          "enum": [
            "deprecated",
            "disallowed",
            "approved",
            "recommended",
            "legacy_only",
            "specified",
            "in_development",
            "selected",
            "required",
            "default",
            "phase_out_planned",
            "unspecified",
            "draft"
          ]
        },
        "normative_force": {
          "enum": [
            "binding_law",
            "binding_contract_or_scheme",
            "mandatory_for_defined_scope",
            "normative_standard",
            "guidance",
            "recommendation",
            "proposal",
            "informational",
            "unknown"
          ]
        },
        "summary": {
          "type": "string",
          "minLength": 1
        },
        "effective": {
          "$ref": "#/definitions/effective"
        },
        "conditions": {
          "$ref": "#/definitions/conditions"
        },
        "evidence": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/evidence"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "confidence": {
          "enum": [
            "confirmed",
            "disputed",
            "unverified"
          ]
        },
        "publication_state": {
          "enum": [
            "draft",
            "published",
            "withdrawn",
            "archived"
          ]
        },
        "last_verified_at": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "review_method": {
          "anyOf": [
            {
              "enum": [
                "automated_source_readback",
                "maintainer_review",
                "independent_technical_review"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "review_interval_days": {
          "type": "integer",
          "minimum": 1,
          "maximum": 90
        },
        "requirement": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "field",
            "value",
            "unit"
          ],
          "properties": {
            "field": {
              "type": "string",
              "minLength": 1
            },
            "value": {
              "type": "integer",
              "minimum": 0
            },
            "unit": {
              "type": "string",
              "minLength": 1
            }
          }
        }
      }
    },
    "advisory": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "title",
        "issuers",
        "issued",
        "scope",
        "summary",
        "affected_algorithms",
        "actions",
        "evidence",
        "last_verified_at",
        "review_interval_days",
        "review_method",
        "confidence",
        "publication_state"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "issuers": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "issued": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "scope": {
          "type": "string",
          "minLength": 1
        },
        "summary": {
          "type": "string",
          "minLength": 1
        },
        "affected_algorithms": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "status",
            "ids"
          ],
          "properties": {
            "status": {
              "enum": [
                "specified",
                "unspecified"
              ]
            },
            "ids": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
              },
              "minItems": 0,
              "uniqueItems": true
            }
          }
        },
        "actions": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "evidence": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/evidence"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "last_verified_at": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "review_interval_days": {
          "type": "integer",
          "minimum": 1,
          "maximum": 90
        },
        "review_method": {
          "anyOf": [
            {
              "enum": [
                "automated_source_readback",
                "maintainer_review",
                "independent_technical_review"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "confidence": {
          "enum": [
            "confirmed",
            "disputed",
            "unverified"
          ]
        },
        "publication_state": {
          "enum": [
            "draft",
            "published",
            "withdrawn",
            "archived"
          ]
        }
      }
    },
    "change": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "date",
        "kind",
        "before",
        "after",
        "claims",
        "advisories",
        "sources"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
        },
        "date": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "kind": {
          "enum": [
            "new",
            "date_moved",
            "status_changed",
            "scope_changed",
            "source_corrected",
            "disputed",
            "superseded",
            "retracted",
            "reverified"
          ]
        },
        "before": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "after": {
          "type": "string",
          "minLength": 1
        },
        "claims": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "revision"
            ],
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
              },
              "revision": {
                "type": "integer",
                "minimum": 1
              }
            }
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "advisories": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
          },
          "minItems": 1,
          "uniqueItems": true
        }
      }
    },
    "research": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "row",
        "subjects",
        "priority",
        "state",
        "checked_at",
        "method",
        "sources",
        "claim_ids",
        "outcome",
        "next_action"
      ],
      "properties": {
        "row": {
          "type": "integer",
          "minimum": 1,
          "maximum": 40
        },
        "subjects": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "priority": {
          "enum": [
            "high",
            "normal"
          ]
        },
        "state": {
          "enum": [
            "verified",
            "partial",
            "unresolved",
            "blocked"
          ]
        },
        "checked_at": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "method": {
          "enum": [
            "automated_source_readback",
            "maintainer_review",
            "independent_technical_review"
          ]
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "claim_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "outcome": {
          "type": "string",
          "minLength": 1
        },
        "next_action": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        }
      }
    }
  }
}
