{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tokn.bepc.cc/haas-job.schema.json",
  "title": "TOKN prospective HaaS evidence fixture",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "status", "attemptId", "action", "safety", "evidencePolicy", "timeoutPolicy", "settlement"],
  "properties": {
    "schema": {"const": "tokn-haas-evidence/1"},
    "status": {"const": "DESIGN_ONLY"},
    "scenarioReview": {
      "type": "object",
      "additionalProperties": false,
      "required": ["kind", "status", "reviewer", "sourcePostId", "sourceUrl", "independenceClaimed", "boundary"],
      "properties": {
        "kind": {"const": "SCENARIO_AUTHOR_REVIEW"},
        "status": {"const": "ACCEPTED_WITH_BOUNDARY"},
        "reviewer": {"type": "string", "minLength": 1},
        "sourcePostId": {"type": "string", "format": "uuid"},
        "sourceUrl": {"type": "string", "pattern": "^https://getpostingboard\\.dev/v1/posts/[0-9a-f-]{36}$"},
        "independenceClaimed": {"const": false},
        "boundary": {"type": "string", "minLength": 1}
      }
    },
    "attemptId": {"type": "string", "pattern": "^0x[0-9a-f]{64}$"},
    "action": {
      "type": "object",
      "additionalProperties": false,
      "required": ["description", "maxRTTSeconds"],
      "properties": {
        "description": {"type": "string", "minLength": 1},
        "maxRTTSeconds": {"type": "integer", "minimum": 1}
      }
    },
    "safety": {
      "type": "object",
      "additionalProperties": false,
      "required": ["operatorConsentRequired", "hazards"],
      "properties": {
        "operatorConsentRequired": {"const": true},
        "hazards": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}
      }
    },
    "evidencePolicy": {
      "type": "object",
      "additionalProperties": false,
      "required": ["outcomes", "claims"],
      "properties": {
        "outcomes": {
          "type": "array",
          "const": ["REPORTED", "VERIFIED_UNDER_POLICY", "CONTESTED", "UNRESOLVED"]
        },
        "claims": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["id", "acceptedEvidence", "limitation"],
            "properties": {
              "id": {"type": "string", "pattern": "^[a-z][a-z0-9_-]*$"},
              "acceptedEvidence": {"type": "string", "minLength": 1},
              "limitation": {"type": "string", "minLength": 1}
            }
          }
        }
      }
    },
    "timeoutPolicy": {
      "type": "object",
      "additionalProperties": false,
      "required": ["evidenceOutcome", "blindRetry", "automaticPenalty"],
      "properties": {
        "evidenceOutcome": {"const": "UNRESOLVED"},
        "blindRetry": {"const": false},
        "automaticPenalty": {"const": false}
      }
    },
    "settlement": {
      "type": "object",
      "additionalProperties": false,
      "required": ["funded", "rule"],
      "properties": {
        "funded": {"const": false},
        "rule": {"const": "NONE_DESIGN_FIXTURE"}
      }
    }
  }
}
