{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thehiveryiq.com/.well-known/schemas/eval-administration-v1.json",
  "title": "Evaluation Administration Receipt, v1",
  "type": "object",
  "required": [
    "receipt_id",
    "payload_sha256",
    "sig_b64u",
    "key_id",
    "algorithm",
    "ts",
    "signed_body"
  ],
  "additionalProperties": false,
  "properties": {
    "receipt_id": {
      "type": "string",
      "pattern": "^r_eval\\.administration_[0-9]{10,}_[0-9a-f]{12}$"
    },
    "payload_sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "sig_b64u": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{86}$"
    },
    "key_id": {
      "type": "string",
      "pattern": "^did:(hive|web|key):[A-Za-z0-9._:%-]+$"
    },
    "algorithm": {
      "type": "string",
      "const": "Ed25519"
    },
    "ts": {
      "type": "integer",
      "minimum": 1000000000
    },
    "signed_body": {
      "type": "object",
      "required": [
        "receipt_type",
        "schema",
        "administration_id",
        "tenant_id",
        "evar_ref",
        "testset_ref",
        "subject",
        "administrator",
        "separation",
        "relationship",
        "independence_class",
        "evaluated_at",
        "boundary"
      ],
      "additionalProperties": false,
      "properties": {
        "receipt_type": {
          "type": "string",
          "const": "eval.administration"
        },
        "schema": {
          "type": "string",
          "const": "r1.0.0"
        },
        "administration_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "tenant_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "evar_ref": {
          "type": "object",
          "required": [
            "receipt_id",
            "payload_sha256"
          ],
          "additionalProperties": false,
          "properties": {
            "receipt_id": {
              "type": "string",
              "pattern": "^r_eval\\.attestation_[0-9]{10,}_[0-9a-f]{12}$"
            },
            "payload_sha256": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          }
        },
        "testset_ref": {
          "type": "object",
          "required": [
            "digest_sha256",
            "committed_at",
            "item_count",
            "disclosed_to_subject_at"
          ],
          "additionalProperties": false,
          "properties": {
            "digest_sha256": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "committed_at": {
              "type": "string",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?Z$"
            },
            "item_count": {
              "type": "integer",
              "minimum": 0
            },
            "disclosed_to_subject_at": {
              "type": "string",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?Z$"
            }
          }
        },
        "subject": {
          "type": "object",
          "required": [
            "did",
            "role"
          ],
          "additionalProperties": false,
          "properties": {
            "did": {
              "type": "string",
              "pattern": "^did:(hive|web|key):[A-Za-z0-9._:%-]+$"
            },
            "role": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          }
        },
        "administrator": {
          "type": "object",
          "required": [
            "did"
          ],
          "additionalProperties": false,
          "properties": {
            "did": {
              "type": "string",
              "pattern": "^did:(hive|web|key):[A-Za-z0-9._:%-]+$"
            }
          }
        },
        "separation": {
          "type": "object",
          "required": [
            "selected_items_by",
            "executed_run_by",
            "scored_results_by"
          ],
          "additionalProperties": false,
          "properties": {
            "selected_items_by": {
              "type": "string",
              "enum": [
                "subject",
                "administrator",
                "third_party",
                "automated"
              ]
            },
            "executed_run_by": {
              "type": "string",
              "enum": [
                "subject",
                "administrator",
                "third_party",
                "automated"
              ]
            },
            "scored_results_by": {
              "type": "string",
              "enum": [
                "subject",
                "administrator",
                "third_party",
                "automated"
              ]
            }
          }
        },
        "relationship": {
          "type": "object",
          "required": [
            "administrator_to_subject"
          ],
          "additionalProperties": false,
          "properties": {
            "administrator_to_subject": {
              "type": "string",
              "enum": [
                "same_legal_entity",
                "affiliate",
                "contracted_vendor",
                "unaffiliated",
                "undisclosed"
              ]
            }
          }
        },
        "independence_class": {
          "type": "string",
          "enum": [
            "self_administered",
            "affiliated",
            "contracted",
            "independent",
            "undisclosed"
          ]
        },
        "evaluated_at": {
          "type": "string",
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?Z$"
        },
        "boundary": {
          "type": "string",
          "const": "This receipt attests that a named evaluation administration arrangement was recorded alongside one specific evaluation attestation, that the test set digest was committed at or before the point the subject was told what the test set contained and at or before the evaluation window opened, and that the independence class was recomputed by this service from the declared relationship and separation of duties rather than supplied by the caller. The declared relationship, the declared separation of duties, and the identity of the administrator are recorded as asserted and are not independently verified here. This receipt does not contain, restate, or attest to any evaluation score or result. It does not attest that the test set was appropriate, that its items were representative, that the subject did not obtain the items by another route, that the evaluation method was adequate, or that the administrator was competent. It is not an accreditation, a certification, or an audit opinion, and no standards body, regulator, or insurer currently recognises it as one."
        }
      }
    }
  }
}
