{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/phamhungptithcm/gig/docs/schemas/release-truth-v2026-08-1.schema.json",
  "title": "gig Release Truth Graph",
  "type": "object",
  "required": [
    "schemaVersion",
    "ticketId",
    "verdict",
    "blockingCount",
    "needsReviewCount",
    "evidenceGapCount"
  ],
  "properties": {
    "schemaVersion": { "const": "2026-08-1" },
    "ticketId": { "type": "string", "minLength": 1 },
    "scope": { "type": "string" },
    "fromBranch": { "type": "string" },
    "toBranch": { "type": "string" },
    "verdict": { "enum": ["safe", "warning", "blocked", "unknown"] },
    "blocking": {
      "type": "array",
      "items": { "$ref": "#/$defs/finding" }
    },
    "needsReview": {
      "type": "array",
      "items": { "$ref": "#/$defs/finding" }
    },
    "evidenceGaps": {
      "type": "array",
      "items": { "$ref": "#/$defs/evidenceGap" }
    },
    "blockingCount": { "type": "integer", "minimum": 0 },
    "needsReviewCount": { "type": "integer", "minimum": 0 },
    "evidenceGapCount": { "type": "integer", "minimum": 0 },
    "repositories": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["repository", "verdict", "sourceCommits", "targetCommits", "providerEvidence", "evidenceStatus"],
        "properties": {
          "repository": { "type": "object" },
          "verdict": { "enum": ["safe", "warning", "blocked", "unknown"] },
          "sourceCommits": { "type": "integer", "minimum": 0 },
          "targetCommits": { "type": "integer", "minimum": 0 },
          "providerEvidence": { "type": "object" },
          "evidenceStatus": { "$ref": "#/$defs/collectionStatus" }
        },
        "additionalProperties": true
      }
    }
  },
  "$defs": {
    "collectionStatus": {
      "enum": ["complete", "unavailable", "unsupported"]
    },
    "finding": {
      "type": "object",
      "required": ["id", "code", "severity", "impact", "summary", "source"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "repository": { "type": "string" },
        "code": { "type": "string", "minLength": 1 },
        "severity": { "type": "string" },
        "impact": { "enum": ["block", "review"] },
        "summary": { "type": "string", "minLength": 1 },
        "detail": { "type": "string" },
        "source": { "type": "string", "minLength": 1 },
        "remediation": { "type": "string" }
      },
      "additionalProperties": false
    },
    "evidenceGap": {
      "type": "object",
      "required": ["id", "status", "summary"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "repository": { "type": "string" },
        "status": { "$ref": "#/$defs/collectionStatus" },
        "summary": { "type": "string", "minLength": 1 },
        "next": { "type": "string" }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
