{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/mmerterden/multi-agent-pipeline/pipeline/schemas/issues.schema.json",
  "title": "Assigned issues",
  "description": "What `issues.mjs --json` prints: open items assigned to the current user, Jira and GitHub in one list. No field carries a URL, a host, a person or a path - summaries are scrubbed before they are printed - so every field is x-sensitivity none and --redact changes nothing.",
  "type": "object",
  "additionalProperties": false,
  "required": ["contractVersion", "items", "sources"],
  "properties": {
    "contractVersion": {
      "type": "string",
      "pattern": "^1\\.[0-9]+\\.[0-9]+$",
      "x-sensitivity": "none"
    },
    "items": {
      "type": "array",
      "x-sensitivity": "none",
      "description": "Priority first, then status, then newest.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["key", "summary", "status", "type", "priority", "source"],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^([A-Z][A-Z0-9_]*-[0-9]+|[A-Za-z0-9._-]+/[A-Za-z0-9._-]+#[0-9]+)$",
            "x-sensitivity": "none",
            "description": "A Jira key, or owner/repo#N for GitHub."
          },
          "summary": { "type": "string", "x-sensitivity": "none" },
          "status": { "type": ["string", "null"], "x-sensitivity": "none" },
          "type": { "type": ["string", "null"], "x-sensitivity": "none" },
          "priority": {
            "type": ["string", "null"],
            "x-sensitivity": "none",
            "description": "Jira's priority name. Always null for GitHub, which has none."
          },
          "source": { "enum": ["jira", "github"], "x-sensitivity": "none" }
        }
      }
    },
    "sources": {
      "type": "array",
      "x-sensitivity": "none",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["source", "ok", "count"],
        "properties": {
          "source": { "enum": ["jira", "github"] },
          "ok": { "type": "boolean" },
          "count": { "type": "integer", "minimum": 0 },
          "reason": {
            "enum": ["not-onboarded", "unavailable", "failed"],
            "description": "Why a source contributed nothing. A fixed code, never the tool's own message."
          }
        }
      }
    }
  }
}
