{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://standards.rootblocks.com/schemas/regression/regression-result.v1.schema.json",
  "title": "RootBlocks Regression Result v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "resultId",
    "suiteId",
    "workflowId",
    "standard",
    "status",
    "caseResults",
    "evidenceRef"
  ],
  "properties": {
    "schemaVersion": {
      "const": "rootblocks.regression-result/v1"
    },
    "resultId": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9.-]{2,127}$"
    },
    "suiteId": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9.-]{2,127}$"
    },
    "workflowId": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9.-]{2,127}$"
    },
    "standard": {
      "$ref": "#/$defs/standardRef"
    },
    "status": {
      "enum": ["passed", "failed", "inconclusive", "blocked"]
    },
    "caseResults": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/caseResult"
      }
    },
    "evidenceRef": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9.-]{2,127}$"
    }
  },
  "$defs": {
    "standardRef": {
      "type": "object",
      "additionalProperties": false,
      "required": ["bundleId", "version", "hash"],
      "properties": {
        "bundleId": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9.-]{2,127}$"
        },
        "version": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-[A-Za-z0-9.-]+)?(\\+[A-Za-z0-9.-]+)?$"
        },
        "hash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64,128}$"
        }
      }
    },
    "caseResult": {
      "type": "object",
      "additionalProperties": false,
      "required": ["caseId", "status", "executionId", "traceHash"],
      "properties": {
        "caseId": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9.-]{2,127}$"
        },
        "status": {
          "enum": ["passed", "failed", "inconclusive", "blocked", "skipped"]
        },
        "executionId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 160
        },
        "traceHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64,128}$"
        },
        "failureCode": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9.-]{2,127}$"
        }
      }
    }
  }
}

