{
  "$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
    },
    "status": {
      "enum": [
        "missing",
        "passed",
        "proven",
        "blocked",
        "failed",
        "skipped"
      ]
    },
    "source": {
      "type": "string",
      "minLength": 1
    },
    "proves": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 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": "(synthetic|partial|dry[-_ ]?run|sandbox[-_ ]?limited|network[-_ ]?limited|credential[-_ ]?limited|blocked|missing)"
          }
        },
        "required": [
          "proof_type"
        ]
      },
      "then": {
        "properties": {
          "upgrades_claim": {
            "const": false
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "provider_mode": {
            "pattern": "(synthetic|partial|dry[-_ ]?run|sandbox[-_ ]?limited|network[-_ ]?limited|credential[-_ ]?limited|blocked|missing)"
          }
        },
        "required": [
          "provider_mode"
        ]
      },
      "then": {
        "properties": {
          "upgrades_claim": {
            "const": false
          }
        }
      }
    }
  ],
  "additionalProperties": false
}
