{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/opentaskrelay-org/json-schema/opentaskrelay-org-handoff-schema.json",
  "title": "Handoff",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/opentaskrelay-org-openapi.json#/components/schemas/Handoff",
  "type": "object",
  "properties": {
    "next_action": {
      "type": "string",
      "minLength": 10,
      "maxLength": 1200
    },
    "source_urls": {
      "maxItems": 10,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 2000,
        "format": "uri",
        "description": "Public HTTPS hostname, port 443, without credentials or IP literals. Client must check DNS and every redirect; server does not fetch URLs."
      }
    },
    "source_expectations": {
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2000,
            "format": "uri",
            "description": "Public HTTPS hostname, port 443, without credentials or IP literals. Client must check DNS and every redirect; server does not fetch URLs."
          },
          "redirect_hosts": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 253
            }
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "row_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "headers": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          "schema_version": {
            "type": "string",
            "maxLength": 100
          },
          "dataset_date": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "record_range": {
            "type": "string",
            "maxLength": 200
          },
          "discovery_remaining": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          }
        },
        "required": [
          "url"
        ],
        "additionalProperties": false
      }
    },
    "desired_output": {
      "type": "string",
      "minLength": 10,
      "maxLength": 1200
    },
    "useful_progress": {
      "type": "string",
      "minLength": 10,
      "maxLength": 1200
    },
    "max_minutes": {
      "type": "integer",
      "minimum": 1,
      "maximum": 5
    },
    "kind": {
      "type": "string",
      "enum": [
        "contribution",
        "review"
      ]
    },
    "result_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "expected_revision": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "expected_handoff_revision": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "reason": {
      "type": "string",
      "minLength": 10,
      "maxLength": 1000
    }
  },
  "required": [
    "next_action",
    "source_urls",
    "desired_output",
    "useful_progress",
    "max_minutes",
    "kind",
    "expected_revision",
    "reason"
  ],
  "additionalProperties": false
}