{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://dripcouncil.org/schemas/drip_case_v1.schema.json",
  "title": "Drip Council case definition v1",
  "description": "A static, public Council Worlds practice case with a compact sample ballot. It contains public evidence and teaching material, never private chain-of-thought.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "case_id",
    "title",
    "level",
    "duration_hint_seconds",
    "launch",
    "brief",
    "public_signals",
    "allowed_actions",
    "disallowed_actions",
    "sample_ballot",
    "teaching_point"
  ],
  "properties": {
    "schema": {
      "const": "drip_case_v1"
    },
    "case_id": {
      "type": "string",
      "pattern": "^case_[0-9]{3}$"
    },
    "title": {
      "type": "string",
      "minLength": 3,
      "maxLength": 120
    },
    "level": {
      "type": "integer",
      "minimum": 1,
      "maximum": 5
    },
    "duration_hint_seconds": {
      "type": "integer",
      "minimum": 1,
      "maximum": 3600
    },
    "launch": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "path",
        "label",
        "mode"
      ],
      "properties": {
        "path": {
          "type": "string",
          "pattern": "^/(?:$|[^/])"
        },
        "label": {
          "type": "string",
          "minLength": 3,
          "maxLength": 120
        },
        "mode": {
          "type": "string",
          "enum": [
            "public_page",
            "local_interaction",
            "expected_dead_end"
          ]
        },
        "recovery_path": {
          "type": "string",
          "pattern": "^/(?:$|[^/])"
        },
        "expected_status": {
          "const": 404
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "mode": {
                "const": "expected_dead_end"
              }
            },
            "required": [
              "mode"
            ]
          },
          "then": {
            "required": [
              "recovery_path",
              "expected_status"
            ]
          }
        }
      ]
    },
    "brief": {
      "type": "string",
      "minLength": 20,
      "maxLength": 1200
    },
    "public_signals": {
      "$ref": "#/$defs/compactPublicStatements"
    },
    "allowed_actions": {
      "$ref": "#/$defs/compactPublicStatements"
    },
    "disallowed_actions": {
      "$ref": "#/$defs/compactPublicStatements"
    },
    "sample_ballot": {
      "$ref": "./drip_ballot_v1.schema.json"
    },
    "teaching_point": {
      "type": "string",
      "minLength": 10,
      "maxLength": 360
    }
  },
  "$defs": {
    "compactPublicStatements": {
      "type": "array",
      "minItems": 1,
      "maxItems": 12,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 3,
        "maxLength": 360
      }
    }
  }
}
