{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://developer.reits.tech/schemas/auth-s08-r02-c02-contribution-custody-handoff.v1.schema.json",
  "title": "Auth S08 R02 C02 受控带外交接与保全链清单",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "subknifeId", "parentSubknife", "status", "progress", "boundary", "tool", "channels", "lanes", "stateMachine", "checkpoints", "rejectionCatalog", "outputs", "qaGates", "decision"],
  "properties": {
    "schemaVersion": { "const": "developer.reits.tech/auth-s08-r02-c02-contribution-custody-handoff/v1" },
    "subknifeId": { "const": "D05-A03-P03c-S08-R02-C02-H01-P04" },
    "parentSubknife": { "const": "D05-A03-P03c-S08-R02-C02-H01-P03" },
    "status": { "const": "CUSTODY_HANDOFF_KIT_READY_EXTERNAL_DISPATCH_ABSENT" },
    "progress": { "type": "object" },
    "boundary": { "type": "object" },
    "tool": { "type": "object" },
    "channels": {
      "type": "array",
      "minItems": 3,
      "maxItems": 3,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "label", "rule", "default"],
        "properties": {
          "id": { "enum": ["CONTROLLED_REMOVABLE_MEDIA", "CONTROLLED_FILE_EXCHANGE", "IN_PERSON_OFFLINE_TRANSFER"] },
          "label": { "type": "string" },
          "rule": { "type": "string" },
          "default": { "type": "boolean" }
        }
      }
    },
    "lanes": {
      "type": "array",
      "minItems": 4,
      "maxItems": 4,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["sequence", "ownerId", "role", "state", "senderControl", "receiverControl", "dualControlRequired"],
        "properties": {
          "sequence": { "type": "integer", "minimum": 1, "maximum": 4 },
          "ownerId": { "enum": ["AUTH", "SECURITY", "SRE_DBA", "QA_WITNESS"] },
          "role": { "type": "string" },
          "state": { "const": "NOT_DISPATCHED" },
          "senderControl": { "type": "string" },
          "receiverControl": { "const": "OPERATOR_QUARANTINE_INTAKE" },
          "dualControlRequired": { "const": true }
        }
      }
    },
    "stateMachine": { "type": "array", "minItems": 5, "maxItems": 5 },
    "checkpoints": {
      "type": "array",
      "minItems": 14,
      "maxItems": 14,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "name", "failureCode"],
        "properties": {
          "id": { "type": "string", "pattern": "^H(0[1-9]|1[0-4])$" },
          "name": { "type": "string" },
          "failureCode": { "type": "string", "pattern": "^E_[A-Z0-9_]+$" }
        }
      }
    },
    "rejectionCatalog": { "type": "array", "minItems": 14, "maxItems": 14 },
    "outputs": { "type": "array", "minItems": 2, "maxItems": 2 },
    "qaGates": { "type": "array", "minItems": 14, "maxItems": 14 },
    "decision": {
      "type": "object",
      "required": ["custodyHandoffToolReady", "realDispatches", "realArrivals", "realHashMatches", "realQuarantined", "externalReceiptAccepted", "authoritySetBound", "c02Complete", "c03Admitted", "productionHeld", "nextRequiredEvent"],
      "properties": {
        "custodyHandoffToolReady": { "const": true },
        "realDispatches": { "const": 0 },
        "realArrivals": { "const": 0 },
        "realHashMatches": { "const": 0 },
        "realQuarantined": { "const": 0 },
        "externalReceiptAccepted": { "const": false },
        "authoritySetBound": { "const": false },
        "c02Complete": { "const": false },
        "c03Admitted": { "const": false },
        "productionHeld": { "const": true },
        "nextRequiredEvent": { "type": "string" }
      },
      "additionalProperties": false
    }
  }
}
