{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://law.arxo.io/schema/focused-evaluation.schema.json",
  "title": "Arxo focused evaluation 0.1",
  "description": "The answer document of a `focused_truth` query: the projection of the full `truth` document D over the query cone. It is a separate form from the full core evaluation document on purpose: a consumer that requires the full audit document rejects this one by schema. The legal answer (truthStatus, evaluationStatus, missingInputs, judgmentRequests, refusal) equals D; the proof graph certifies only the cone.",
  "$comment": "SPEC §181.3; DECISION-0368; SPEC §208; form law.core.evaluation/0.x",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "evaluationKind",
    "manifest",
    "focusManifest",
    "results",
    "conflicts",
    "proofGraph",
    "issues",
    "answerHash",
    "focusedResultHash"
  ],
  "properties": {
    "schemaVersion": {
      "const": "law.core.focused-evaluation/0.1"
    },
    "evaluationKind": {
      "const": "focused_truth"
    },
    "manifest": {
      "$ref": "evaluation.schema.json#/$defs/EvaluationManifest"
    },
    "focusManifest": {
      "$ref": "#/$defs/FocusManifest"
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "evaluation.schema.json#/$defs/EvaluationResult"
      }
    },
    "conflicts": {
      "type": "array",
      "items": {
        "$ref": "evaluation.schema.json#/$defs/ConflictReport"
      }
    },
    "proofGraph": {
      "$ref": "#/$defs/FocusedProofGraph"
    },
    "issues": {
      "type": "array",
      "items": {
        "$ref": "evaluation.schema.json#/$defs/Issue"
      }
    },
    "evidenceAcceptance": {
      "$ref": "evaluation.schema.json#/$defs/EvidenceAcceptanceReport"
    },
    "answerHash": {
      "$ref": "evaluation.schema.json#/$defs/Digest"
    },
    "focusedResultHash": {
      "$ref": "evaluation.schema.json#/$defs/Digest"
    },
    "executionReceipt": {
      "$ref": "evaluation.schema.json#/$defs/ExecutionReceipt"
    }
  },
  "$defs": {
    "FocusManifest": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "contract",
        "queryId",
        "profile",
        "completeness",
        "leanCompleteness",
        "cone"
      ],
      "properties": {
        "contract": {
          "const": "law.focus/0.1"
        },
        "queryId": {
          "$ref": "evaluation.schema.json#/$defs/StableId"
        },
        "profile": {
          "const": "i-relational-defeasible"
        },
        "completeness": {
          "const": "query"
        },
        "leanCompleteness": {
          "enum": [
            "not-certified",
            "certified"
          ]
        },
        "cone": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "predicates",
            "coneHash"
          ],
          "properties": {
            "predicates": {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "coneHash": {
              "$ref": "evaluation.schema.json#/$defs/Digest"
            }
          }
        }
      }
    },
    "FocusedProofGraph": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "nodes",
        "roots",
        "focusedProofHash"
      ],
      "properties": {
        "nodes": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "$ref": "evaluation.schema.json#/$defs/ProofNode"
              },
              {
                "$ref": "#/$defs/ConeCompletionNode"
              }
            ]
          }
        },
        "roots": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "$ref": "evaluation.schema.json#/$defs/StableId"
          }
        },
        "focusedProofHash": {
          "$ref": "evaluation.schema.json#/$defs/Digest"
        }
      }
    },
    "ConeCompletionNode": {
      "description": "The subprogram of the cone was brought to its fixpoint over all strata. Premises are every `candidate_closure` of the slice; checked by re-deriving the cone, not by the certificate alone.",
      "$comment": "SPEC §181.3",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "kind",
        "conclusion",
        "premises",
        "sourceAnchors",
        "evidence",
        "attributes"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^urn:proof:cone-completion:[0-9a-f]{64}$"
        },
        "kind": {
          "const": "cone_completion"
        },
        "conclusion": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "cone"
          ],
          "properties": {
            "cone": {
              "$ref": "evaluation.schema.json#/$defs/Digest"
            }
          }
        },
        "premises": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "$ref": "evaluation.schema.json#/$defs/StableId"
          }
        },
        "sourceAnchors": {
          "type": "array",
          "maxItems": 0
        },
        "evidence": {
          "type": "array",
          "maxItems": 0
        },
        "attributes": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "coneHash",
            "programSemanticHash",
            "evaluationInputSemanticHash"
          ],
          "properties": {
            "coneHash": {
              "$ref": "evaluation.schema.json#/$defs/Digest"
            },
            "programSemanticHash": {
              "type": "string"
            },
            "evaluationInputSemanticHash": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
