{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "$id": "summary.schema.json",
  "title": "Run summary",
  "required": [
    "schema_version",
    "run_id",
    "environment_valid",
    "production_equivalent",
    "counts",
    "verdict",
    "artifacts"
  ],
  "properties": {
    "schema_version": {
      "const": "1.0.0"
    },
    "run_id": {
      "type": "string",
      "minLength": 1
    },
    "environment_valid": {
      "type": "boolean"
    },
    "production_equivalent": {
      "type": "boolean"
    },
    "counts": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "pass",
        "fail",
        "blocked"
      ],
      "properties": {
        "pass": {
          "type": "integer",
          "minimum": 0
        },
        "fail": {
          "type": "integer",
          "minimum": 0
        },
        "blocked": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "verdict": {
      "enum": [
        "PASS",
        "FAIL",
        "BLOCKED"
      ]
    },
    "blocked_reasons": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "artifacts": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "path",
          "sha256",
          "bytes",
          "producer_version",
          "case_ids"
        ],
        "properties": {
          "path": {
            "type": "string",
            "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\).+$"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "bytes": {
            "type": "integer",
            "minimum": 0
          },
          "producer_version": {
            "type": "string",
            "minLength": 1
          },
          "case_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        }
      }
    }
  }
}
