{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.com/schemas/evidence-index.schema.json",
  "title": "Published Evidence Index",
  "type": "object",
  "required": [
    "description",
    "published_at",
    "regenerate",
    "reports",
    "source_chain"
  ],
  "properties": {
    "description": {
      "type": "string",
      "minLength": 1
    },
    "published_at": {
      "type": "string",
      "minLength": 10
    },
    "regenerate": {
      "type": "string",
      "minLength": 1
    },
    "reports": {
      "type": "array",
      "minItems": 8,
      "items": {
        "type": "object",
        "required": [
          "id",
          "publicPath",
          "command",
          "generated_at",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "publicPath": {
            "type": "string",
            "pattern": "^/evidence/"
          },
          "command": {
            "type": "string",
            "minLength": 1
          },
          "generated_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "findings": {
            "type": [
              "number",
              "null"
            ]
          },
          "status": {
            "enum": [
              "pass",
              "has-critical-findings"
            ]
          }
        }
      }
    },
    "source_chain": {
      "type": "array",
      "minItems": 10,
      "items": {
        "type": "object",
        "required": [
          "sourcePath",
          "publicPath"
        ],
        "properties": {
          "sourcePath": {
            "type": "string",
            "minLength": 1
          },
          "publicPath": {
            "type": "string",
            "pattern": "^/evidence/source-chain/"
          }
        }
      }
    }
  }
}
