{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/multi-agent-ecosystem/multi-agent-pipeline/pipeline/schemas/prs.schema.json",
  "title": "Pull requests",
  "description": "What GET /v1/prs returns (`work-items.mjs prs`): open pull requests where you are asked to review or are the author. sources says per host whether it was read; Bitbucket listing is not implemented and says so rather than showing an empty list. url is dropped under redact.",
  "type": "object",
  "additionalProperties": false,
  "required": ["contractVersion", "items", "sources"],
  "properties": {
    "contractVersion": {
      "type": "string",
      "pattern": "^1\\.[0-9]+\\.[0-9]+$",
      "x-sensitivity": "none"
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["source", "repo", "number", "title", "url", "author", "updatedAt", "role"],
        "properties": {
          "source": {
            "enum": ["github", "bitbucket"]
          },
          "account": {
            "type": ["string", "null"],
            "x-sensitivity": "local",
            "description": "The GitHub login the pull request was listed under, when gh is logged in to more than one account (personal and corporate). Null for Bitbucket."
          },
          "repo": {
            "type": "string"
          },
          "number": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "url": {
            "type": ["string", "null"],
            "x-sensitivity": "local"
          },
          "author": {
            "type": ["string", "null"]
          },
          "updatedAt": {
            "type": ["string", "null"]
          },
          "role": {
            "enum": ["reviewer", "author"]
          }
        }
      }
    },
    "sources": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["source", "ok", "count"],
        "properties": {
          "source": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          },
          "count": {
            "type": "integer"
          },
          "reason": {
            "type": "string"
          }
        }
      }
    }
  }
}
