{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.jrsstandard.com/jrs-decision-reconstruction-manifest-v1.0.1.schema.json",
  "title": "JRS Evidence & Decision Reconstruction Manifest",
  "description": "Portable evidence artifact describing one JRS evaluation. Public explanation: https://www.jrsstandard.com/manifest.html. By default the manifest does NOT contain the underlying record; content_class declares what it does carry. This schema does not resolve the Codebook-to-engine condition mapping, which is UNRESOLVED for three of five pairs; condition_vocabulary declares which vocabulary the keys belong to. Schema revision 1.0.1 restricts the JRS Standard and Codebook version identifiers to the versions established in the current release inventory. Manifest format remains 1.0.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "manifest_id",
    "manifest_version",
    "created_at",
    "jrs_version",
    "engine",
    "input",
    "condition_vocabulary",
    "conditions",
    "routing",
    "human_review",
    "content_class",
    "integrity",
    "codebook_version"
  ],
  "properties": {
    "manifest_id": {
      "type": "string",
      "format": "uuid"
    },
    "manifest_version": {
      "const": "1.0"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "jrs_version": {
      "enum": [
        "1.0"
      ],
      "description": "Supported JRS Standard version at schema revision 1.0.1."
    },
    "codebook_version": {
      "enum": [
        "1.0"
      ],
      "description": "Supported JRS Codebook version at schema revision 1.0.1."
    },
    "engine": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "version",
        "model",
        "api_version"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "model": {
          "type": "string",
          "description": "Versioned infrastructure, not methodology."
        },
        "api_version": {
          "type": "string"
        }
      }
    },
    "input": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "hash",
        "hash_algorithm"
      ],
      "properties": {
        "hash": {
          "type": "string",
          "pattern": "^[a-z0-9-]+:[A-Fa-f0-9]{32,128}$"
        },
        "hash_algorithm": {
          "enum": [
            "sha256",
            "sha384",
            "sha512"
          ]
        },
        "identifier": {
          "type": "string",
          "description": "Customer-assigned. Not generated by JRS."
        },
        "length_chars": {
          "type": "integer",
          "minimum": 0
        },
        "truncated": {
          "type": "boolean",
          "description": "True if the evaluated text was truncated. Omitting this when true misrepresents what was evaluated."
        },
        "source_hash": {
          "type": "string",
          "pattern": "^[a-z0-9-]+:[A-Fa-f0-9]{32,128}$",
          "description": "Hash of the FULL submitted record when it exceeded the evaluation limit. input.hash always covers the text actually evaluated; this lets a holder of the original prove correspondence anyway."
        }
      }
    },
    "context": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "identifier": {
          "type": "string"
        },
        "decision_type": {
          "type": "string"
        },
        "evaluated_by": {
          "type": "string"
        }
      }
    },
    "condition_vocabulary": {
      "enum": [
        "jrs_codebook_1.0",
        "review_engine_keys"
      ],
      "description": "REQUIRED. Which vocabulary the condition keys belong to. A generator without an owner-declared mapping MUST emit review_engine_keys and MUST NOT relabel engine keys as Codebook conditions."
    },
    "conditions": {
      "type": "object",
      "minProperties": 5,
      "maxProperties": 5,
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "enum": [
              "pass",
              "review",
              "gap"
            ]
          },
          "note": {
            "type": "string",
            "maxLength": 400,
            "description": "Model output derived from the record. May paraphrase it. Its presence makes the manifest derived_record_content."
          },
          "note_content_class": {
            "enum": [
              "no_record_content",
              "derived_record_content",
              "contains_record"
            ]
          }
        }
      }
    },
    "routing": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "value",
        "vocabulary"
      ],
      "properties": {
        "value": {
          "type": "string"
        },
        "vocabulary": {
          "enum": [
            "openapi_1.0_routing",
            "engine_determination"
          ],
          "description": "Two record-level vocabularies exist. Naming it prevents a reader assuming the wrong one."
        }
      }
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      }
    },
    "human_review": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "required"
      ],
      "properties": {
        "required": {
          "type": "boolean",
          "default": true,
          "description": "Defaults true. The engine is empirically unvalidated, so a default of false would assert what the research does not support."
        },
        "reason": {
          "type": "string"
        }
      }
    },
    "evaluation": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "runs": {
          "type": "integer",
          "minimum": 1
        },
        "variance": {
          "type": "object"
        },
        "reproducibility_note": {
          "type": "string",
          "description": "Must not describe reproducibility as accuracy or as validation."
        }
      }
    },
    "content_class": {
      "enum": [
        "no_record_content",
        "derived_record_content",
        "contains_record"
      ],
      "description": "REQUIRED. Declares what class of record-related content this manifest carries."
    },
    "integrity": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "manifest_hash",
        "canonicalization"
      ],
      "properties": {
        "manifest_hash": {
          "type": "string",
          "pattern": "^[a-z0-9-]+:[A-Fa-f0-9]{32,128}$",
          "description": "Over the canonical form excluding this object. Detects alteration; does NOT authenticate origin."
        },
        "canonicalization": {
          "type": "string",
          "examples": [
            "JCS/RFC8785"
          ]
        },
        "signature": {
          "type": "string"
        },
        "signature_alg": {
          "type": "string"
        },
        "signed_by": {
          "type": "string"
        }
      }
    }
  }
}
