{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "required": [
    "artifact_id",
    "type",
    "phase_id",
    "status",
    "source",
    "proves",
    "proof_type",
    "provider_mode",
    "upgrades_claim"
  ],
  "properties": {
    "artifact_id": { "type": "string", "minLength": 1 },
    "type": { "type": "string", "minLength": 1 },
    "phase_id": { "type": "string", "minLength": 1 },
    "capability_id": { "type": "string" },
    "status": {
      "enum": ["missing", "passed", "proven", "blocked", "failed", "skipped"]
    },
    "source": { "type": "string", "minLength": 1 },
    "proves": {
      "type": "array",
      "minItems": 1,
      "items": { "type": "string", "minLength": 1 }
    },
    "proof_type": { "type": "string", "minLength": 1 },
    "provider_mode": { "type": "string", "minLength": 1 },
    "upgrades_claim": { "type": "boolean" },
    "commands": { "type": "array", "items": { "type": "string" } },
    "changed_files": { "type": "array", "items": { "type": "string" } },
    "blocker": { "type": "string" },
    "notes": { "type": "string" }
  },
  "allOf": [
    {
      "if": { "properties": { "status": { "enum": ["missing", "blocked", "failed", "skipped"] } }, "required": ["status"] },
      "then": { "properties": { "upgrades_claim": { "const": false } } }
    },
    {
      "if": { "properties": { "proof_type": { "pattern": "(?i)(synthetic|partial|dry[-_ ]?run|sandbox|network[-_ ]?limited|credential[-_ ]?limited|blocked|missing)" } }, "required": ["proof_type"] },
      "then": { "properties": { "upgrades_claim": { "const": false } } }
    },
    {
      "if": { "properties": { "provider_mode": { "pattern": "(?i)(synthetic|dry[-_ ]?run|sandbox|network[-_ ]?limited|credential[-_ ]?limited|blocked|missing|not_runtime)" } }, "required": ["provider_mode"] },
      "then": { "properties": { "upgrades_claim": { "const": false } } }
    }
  ],
  "additionalProperties": true
}
