{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/multi-agent-ecosystem/multi-agent-pipeline/pipeline/schemas/issue-maturity.schema.json",
  "title": "Issue maturity",
  "description": "What GET /v1/issues/{key}/maturity returns (`work-items.mjs maturity <key>`, from lib/issue-fetcher.sh): the maturity check the pipeline runs before it starts on an issue. key is a Jira key, owner/repo#N or #N. Blockers stop a run; warnings are asked about. Text is redacted.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "contractVersion",
    "key",
    "kind",
    "title",
    "type",
    "status",
    "maturity",
    "description"
  ],
  "properties": {
    "contractVersion": {
      "type": "string",
      "pattern": "^1\\.[0-9]+\\.[0-9]+$",
      "x-sensitivity": "none"
    },
    "key": {
      "type": "string"
    },
    "kind": {
      "enum": ["jira", "github", "freetext"]
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": ["string", "null"]
    },
    "status": {
      "type": ["string", "null"]
    },
    "maturity": {
      "type": "object",
      "additionalProperties": false,
      "required": ["score", "blockers", "warnings", "summary"],
      "properties": {
        "score": {
          "type": ["number", "null"]
        },
        "blockers": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "summary": {
          "type": ["string", "null"]
        }
      }
    },
    "description": {
      "type": ["string", "null"]
    }
  }
}
