{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/multi-agent-ecosystem/multi-agent-pipeline/pipeline/schemas/review-verdict.schema.json",
  "title": "Review verdict",
  "description": "What POST /v1/runs/{id}/review-verdict returns (`work-items.mjs verdict <id> [--post]`). Only a finished review whose every finding is triaged (accepted, rejected or deferred) is previewed (409 review-incomplete otherwise). The preview carries findingsDigest, the hash of the findings it was made from, and the decision lib/post-pr-review.sh would post (approve with no accepted blocking or important finding, else needs-work), a confirmToken bound to that decision and digest, and expiresAt; a confirmation after either changed is 409 confirm-mismatch; the confirmation runs post-pr-review.sh, which posts the comments and the verdict with the user's own credential, and says posted.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "contractVersion",
    "taskId",
    "provider",
    "prNumber",
    "decision",
    "acceptedBlocking",
    "acceptedImportant",
    "findings",
    "findingsDigest"
  ],
  "properties": {
    "contractVersion": {
      "type": "string",
      "pattern": "^1\\.[0-9]+\\.[0-9]+$",
      "x-sensitivity": "none"
    },
    "taskId": {
      "type": "string"
    },
    "provider": {
      "enum": ["github", "bitbucket-server", null]
    },
    "prNumber": {
      "type": ["integer", "null"]
    },
    "decision": {
      "enum": ["approve", "needs-work"]
    },
    "acceptedBlocking": {
      "type": "integer"
    },
    "acceptedImportant": {
      "type": "integer"
    },
    "findings": {
      "type": "integer"
    },
    "posted": {
      "type": "boolean"
    },
    "confirmToken": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{16,128}$"
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "findingsDigest": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    }
  }
}
