{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://calvinkennedy.com/schemas/content-proof-contract.schema.json",
  "title": "Content Proof Contract",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "world_state_before",
    "intervention",
    "unknown_outcome",
    "evidence_required",
    "failure_story",
    "world_state_after",
    "decision"
  ],
  "properties": {
    "world_state_before": {
      "type": "string",
      "minLength": 20
    },
    "intervention": {
      "type": "string",
      "minLength": 10
    },
    "unknown_outcome": {
      "type": "string",
      "minLength": 20
    },
    "evidence_required": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 3
      }
    },
    "failure_story": {
      "type": "string",
      "minLength": 20
    },
    "world_state_after": {
      "type": "string",
      "minLength": 20
    },
    "unresolved_assumptions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "default": []
    },
    "decision": {
      "type": "string",
      "enum": [
        "ALLOW_PLANNING",
        "BLOCKED",
        "EXPLANATION_ONLY"
      ]
    },
    "release_authority": {
      "type": "string",
      "enum": [
        "A0",
        "A1",
        "A2",
        "A3",
        "A4"
      ],
      "default": "A3"
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "decision": {
            "const": "ALLOW_PLANNING"
          }
        },
        "required": [
          "decision"
        ]
      },
      "then": {
        "properties": {
          "evidence_required": {
            "minItems": 1
          }
        }
      }
    }
  ]
}
