{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.archal.ai/environment-sample-hosted-evidence/v1",
  "title": "Archal hosted sample lifecycle evidence",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "version",
    "environmentId",
    "sampleId",
    "catalogHash",
    "artifactSha256",
    "verifiedAt",
    "sourceCommit",
    "runtimeBundleDigest",
    "checks",
    "reportHash"
  ],
  "properties": {
    "schema": { "const": "archal.environment-sample-hosted-evidence" },
    "version": { "const": 1 },
    "environmentId": { "type": "string", "minLength": 1 },
    "sampleId": {
      "type": "string",
      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*\\.[a-z0-9]+(?:-[a-z0-9]+)*\\.v1$"
    },
    "catalogHash": { "$ref": "#/$defs/hash" },
    "artifactSha256": { "$ref": "#/$defs/hash" },
    "verifiedAt": { "type": "string", "format": "date-time" },
    "sourceCommit": { "type": "string", "minLength": 1 },
    "runtimeBundleDigest": { "type": "string", "minLength": 1 },
    "checks": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "start",
        "ready",
        "stateLoad",
        "firstRead",
        "mutation",
        "diff",
        "reset",
        "baselineCompare",
        "isolation",
        "destroy",
        "orphanCheck"
      ],
      "properties": {
        "start": { "$ref": "#/$defs/check" },
        "ready": { "$ref": "#/$defs/check" },
        "stateLoad": { "$ref": "#/$defs/check" },
        "firstRead": { "$ref": "#/$defs/check" },
        "mutation": { "$ref": "#/$defs/check" },
        "diff": { "$ref": "#/$defs/check" },
        "reset": { "$ref": "#/$defs/check" },
        "baselineCompare": { "$ref": "#/$defs/check" },
        "isolation": { "$ref": "#/$defs/check" },
        "destroy": { "$ref": "#/$defs/check" },
        "orphanCheck": { "$ref": "#/$defs/check" }
      }
    },
    "reportHash": { "$ref": "#/$defs/hash" }
  },
  "$defs": {
    "hash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "check": {
      "type": "object",
      "additionalProperties": false,
      "required": ["status", "evidenceHash"],
      "properties": {
        "status": { "enum": ["pass", "fail"] },
        "evidenceHash": { "$ref": "#/$defs/hash" }
      }
    }
  }
}
