{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://spacemedicinefoundation.org/robotic-medicine/protocols/schema/protocol.schema.json",
  "title": "Space Medicine Foundation robot-readable clinical protocol (conceptual)",
  "description": "Format for conceptual, robot-readable clinical protocols in the Robotic Medicine library. It follows the 13-part framework from Part 1 of the Robotic Medicine series, plus a loss-of-signal and Mars-delay branch. Every protocol in this format is conceptual and NOT FOR CLINICAL USE. Schema version 0.3 (Oct 20, 2026): v0.2 added the rules from the AI-assisted review of batch 1; v0.3 adds the CMO-override branch for medicine hand-over.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "id",
    "slug",
    "title",
    "version",
    "status",
    "conceptual",
    "not_for_clinical_use",
    "category",
    "tier",
    "max_autonomy",
    "missions",
    "updated",
    "review",
    "fixed_rules",
    "result_language",
    "scope",
    "roles",
    "preconditions",
    "consent",
    "inputs",
    "steps",
    "decisions",
    "stop_rules",
    "red_flags",
    "safety_limits",
    "logs",
    "requirements",
    "validation",
    "signoff",
    "change_control",
    "comms",
    "sources"
  ],
  "properties": {
    "schema_version": {
      "const": "0.3"
    },
    "id": {
      "type": "string",
      "pattern": "^RMP-[A-Z]{2,6}-[0-9]{3}$",
      "description": "Library ID, for example RMP-RENAL-001."
    },
    "slug": {
      "type": "string",
      "pattern": "^rmp-[a-z]{2,6}-[0-9]{3}$",
      "description": "Lower-case ID used in the page address."
    },
    "title": {
      "type": "string",
      "minLength": 10
    },
    "former_ids": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "version": {
      "type": "string",
      "pattern": "^0\\.[0-9]+$",
      "description": "Draft versions only (0.x). Nothing in this library is approved for use."
    },
    "status": {
      "const": "draft"
    },
    "conceptual": {
      "const": true
    },
    "not_for_clinical_use": {
      "const": true
    },
    "category": {
      "enum": [
        "cardio",
        "resp",
        "neuro",
        "eyes",
        "ent",
        "gi",
        "renal",
        "msk",
        "skin",
        "infection",
        "env",
        "rad",
        "behav",
        "pharm",
        "eva",
        "egress",
        "prev"
      ]
    },
    "tier": {
      "enum": [
        1,
        2,
        3
      ]
    },
    "tier_note": {
      "type": "string"
    },
    "max_autonomy": {
      "enum": [
        1,
        2,
        3
      ],
      "description": "Highest autonomy rung: 1 ground-steered, 2 supervised, 3 conditional. Clinical tasks stop at rung 2."
    },
    "rung_note": {
      "type": "string"
    },
    "missions": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "enum": [
          "leo",
          "commercial",
          "moon",
          "mars"
        ]
      }
    },
    "updated": {
      "type": "string",
      "pattern": "^20[0-9]{2}-[01][0-9]-[0-3][0-9]$"
    },
    "review": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "state",
        "text"
      ],
      "properties": {
        "state": {
          "enum": [
            "self-verified",
            "review-requested",
            "reviewed-ai-assisted",
            "fixes-applied-pending-verification"
          ]
        },
        "text": {
          "type": "string"
        },
        "requested": {
          "type": "string"
        },
        "human_clinician_review": {
          "const": false,
          "description": "No named human clinician has reviewed any protocol in this library."
        },
        "reviewed": {
          "type": "string",
          "pattern": "^20[0-9]{2}-[01][0-9]-[0-3][0-9]$"
        },
        "verified_version": {
          "type": "string",
          "pattern": "^[0-9]+\\.[0-9]+$",
          "description": "Change control (Oct 21, 2026): the exact protocol version whose clinical verification is recorded. A PHARM- protocol publishes in the release build only if this equals its version and the content matches the verified hash in pharm-verifications.json."
        },
        "verified": {
          "type": "string",
          "pattern": "^20[0-9]{2}-[01][0-9]-[0-3][0-9]$"
        }
      }
    },
    "fixed_rules": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "flight_surgeon_is_medical_authority",
        "cmo_acts_under_delegated_care",
        "human_starts_and_restarts_robot",
        "robot_never_diagnoses",
        "no_drug_or_fluid_advice_by_robot",
        "safe_state_on_fault_or_no_response",
        "lost_link_pause_then_cmo_decides"
      ],
      "properties": {
        "flight_surgeon_is_medical_authority": {
          "const": true
        },
        "cmo_acts_under_delegated_care": {
          "const": true
        },
        "human_starts_and_restarts_robot": {
          "const": true
        },
        "robot_never_diagnoses": {
          "const": true
        },
        "no_drug_or_fluid_advice_by_robot": {
          "const": true
        },
        "safe_state_on_fault_or_no_response": {
          "const": true
        },
        "lost_link_pause_then_cmo_decides": {
          "const": true,
          "description": "On lost link the robot pauses motion and tells the CMO; the CMO decides whether to continue offline."
        }
      }
    },
    "result_language": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "use",
        "never"
      ],
      "properties": {
        "use": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string"
          }
        },
        "never": {
          "type": "array",
          "contains": {
            "const": "normal"
          },
          "items": {
            "type": "string"
          }
        }
      }
    },
    "scope": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "summary",
        "covers",
        "locked_out"
      ],
      "properties": {
        "summary": {
          "type": "string"
        },
        "why": {
          "type": "string"
        },
        "covers": {
          "$ref": "#/$defs/strs"
        },
        "locked_out": {
          "$ref": "#/$defs/strs"
        },
        "related": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^RMP-[A-Z]{2,6}-[0-9]{3}$"
          }
        }
      }
    },
    "roles": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "medical_authority",
        "onboard_lead",
        "robot_may",
        "robot_may_not"
      ],
      "properties": {
        "medical_authority": {
          "type": "string",
          "pattern": "[Ff]light surgeon"
        },
        "onboard_lead": {
          "type": "string",
          "pattern": "[Cc]rew medical officer"
        },
        "others": {
          "$ref": "#/$defs/strs"
        },
        "robot_may": {
          "$ref": "#/$defs/strs"
        },
        "robot_may_not": {
          "$ref": "#/$defs/strs"
        },
        "commercial": {
          "type": "string",
          "pattern": "operator"
        }
      }
    },
    "preconditions": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/item"
      }
    },
    "consent": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "standard",
        "emergency"
      ],
      "properties": {
        "standard": {
          "type": "string"
        },
        "emergency": {
          "type": "string"
        },
        "withdrawal": {
          "type": "string"
        }
      }
    },
    "inputs": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "source",
          "required",
          "if_missing"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^IN-[0-9]+$"
          },
          "name": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "if_missing": {
            "type": "string"
          }
        }
      }
    },
    "steps": {
      "type": "array",
      "minItems": 3,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "actor",
          "action",
          "success"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^S[0-9]+$"
          },
          "actor": {
            "$ref": "#/$defs/actor"
          },
          "rung": {
            "enum": [
              1,
              2,
              3
            ]
          },
          "action": {
            "type": "string"
          },
          "success": {
            "type": "string"
          },
          "limit": {
            "type": "string"
          },
          "refs": {
            "$ref": "#/$defs/reqs"
          },
          "action_type": {
            "enum": [
              "alert",
              "log",
              "show",
              "scan-compare",
              "send",
              "stay",
              "hold-position",
              "move-clear"
            ],
            "description": "Batch 10 verification R5b: the declared action type of a robot step; required for every robot step of an administration-log protocol, from this closed allow-list."
          }
        },
        "if": {
          "properties": {
            "actor": {
              "const": "robot"
            }
          }
        },
        "then": {
          "required": [
            "rung"
          ]
        },
        "else": {
          "not": {
            "required": [
              "rung"
            ]
          }
        },
        "description": "Every robot action is its own step with a rung; crew and ground steps carry no rung."
      }
    },
    "decisions": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "after",
          "decided_by",
          "question",
          "branches"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^D[0-9]+$"
          },
          "after": {
            "type": "string",
            "pattern": "^S[0-9]+$"
          },
          "decided_by": {
            "$ref": "#/$defs/actor"
          },
          "question": {
            "type": "string"
          },
          "branches": {
            "type": "array",
            "minItems": 2,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "if",
                "then"
              ],
              "properties": {
                "if": {
                  "type": "string"
                },
                "then": {
                  "type": "string"
                },
                "handoff": {
                  "enum": [
                    "none",
                    "cmo-override-only"
                  ],
                  "description": "Required on any branch that shows MISMATCH or CANNOT VERIFY (build check)."
                },
                "override": {
                  "$ref": "#/$defs/cmoOverride"
                }
              },
              "if": {
                "properties": {
                  "handoff": {
                    "const": "cmo-override-only"
                  }
                },
                "required": [
                  "handoff"
                ]
              },
              "then": {
                "required": [
                  "override"
                ]
              },
              "else": {
                "not": {
                  "required": [
                    "override"
                  ]
                }
              }
            }
          },
          "refs": {
            "$ref": "#/$defs/reqs"
          }
        }
      }
    },
    "stop_rules": {
      "type": "array",
      "minItems": 3,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "trigger",
          "action",
          "level"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^X[0-9]+$"
          },
          "trigger": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "level": {
            "enum": [
              "stop",
              "urgent",
              "safe-state",
              "pause"
            ]
          },
          "refs": {
            "$ref": "#/$defs/reqs"
          }
        }
      },
      "contains": {
        "type": "object",
        "properties": {
          "level": {
            "const": "pause"
          }
        },
        "required": [
          "level"
        ]
      }
    },
    "red_flags": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "sign",
          "threshold",
          "action"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^RF[0-9]+$"
          },
          "sign": {
            "type": "string"
          },
          "threshold": {
            "type": "string",
            "description": "A placeholder such as '<set by clinical lead>' unless a cited source gives the value."
          },
          "action": {
            "type": "string"
          },
          "source": {
            "type": "string"
          }
        }
      }
    },
    "safety_limits": {
      "type": "array",
      "minItems": 2,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "value",
          "enforced"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^L[0-9]+$"
          },
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string",
            "pattern": "^<set by (clinical lead|flight surgeon|validation|program environmental lead with the flight surgeon|pharmacy lead)>$|^0$|^none$|^not allowed$",
            "description": "Hard limits are placeholders until validation sets them."
          },
          "enforced": {
            "type": "string"
          },
          "refs": {
            "$ref": "#/$defs/reqs"
          }
        }
      }
    },
    "logs": {
      "type": "array",
      "minItems": 2,
      "items": {
        "$ref": "#/$defs/item"
      }
    },
    "requirements": {
      "type": "array",
      "minItems": 3,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "use"
        ],
        "properties": {
          "id": {
            "$ref": "#/$defs/req"
          },
          "use": {
            "type": "string"
          }
        }
      }
    },
    "validation": {
      "type": "array",
      "minItems": 3,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "stage",
          "what",
          "pass"
        ],
        "properties": {
          "stage": {
            "enum": [
              "simulation",
              "training model",
              "Earth analog",
              "parabolic or station demonstration",
              "flight use under flight surgeon supervision"
            ]
          },
          "what": {
            "type": "string"
          },
          "pass": {
            "type": "string"
          }
        }
      }
    },
    "signoff": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "protocol",
        "each_run",
        "restart_after_stop"
      ],
      "properties": {
        "protocol": {
          "$ref": "#/$defs/strs"
        },
        "each_run": {
          "type": "string"
        },
        "restart_after_stop": {
          "type": "string",
          "pattern": "[Hh]uman"
        }
      }
    },
    "change_control": {
      "type": "array",
      "minItems": 2,
      "items": {
        "type": "string"
      }
    },
    "comms": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "live",
        "loss_of_signal",
        "mars_delay"
      ],
      "properties": {
        "live": {
          "type": "string"
        },
        "loss_of_signal": {
          "$ref": "#/$defs/strs"
        },
        "mars_delay": {
          "$ref": "#/$defs/strs"
        },
        "max_delay_for_live_guidance": {
          "type": "string"
        }
      }
    },
    "sources": {
      "type": "array",
      "minItems": 2,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "key",
          "text",
          "url"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z0-9]+$"
          },
          "text": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "pattern": "^https://"
          },
          "doi": {
            "type": "string",
            "pattern": "^10\\."
          },
          "pmid": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "supports": {
            "type": "string"
          }
        }
      }
    },
    "robot_lockouts": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "diagnosis",
        "drug_or_fluid_advice",
        "starting_stopping_or_adjusting_oxygen_or_any_medicine",
        "self_start_or_self_restart",
        "changing_own_protocol_thresholds_or_limits",
        "handing_over_a_mismatched_item_as_verified"
      ],
      "description": "Things the robot is locked out of in every protocol. Each must be true.",
      "properties": {
        "diagnosis": {
          "const": true
        },
        "drug_or_fluid_advice": {
          "const": true
        },
        "starting_stopping_or_adjusting_oxygen_or_any_medicine": {
          "const": true
        },
        "self_start_or_self_restart": {
          "const": true
        },
        "changing_own_protocol_thresholds_or_limits": {
          "const": true
        },
        "handing_over_a_mismatched_item_as_verified": {
          "const": true
        }
      }
    },
    "rework_note": {
      "type": "string"
    },
    "verification": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "fields",
        "recipient_check",
        "match_label",
        "on_mismatch",
        "scan_failure"
      ],
      "description": "Required for medicine-handling protocols (category pharm, checked at build time). Default on mismatch: seal in a NOT VERIFIED bag and quarantine; never hand over unprompted or to anyone but the CMO; a hand-over happens only through the logged two-step CMO override, and only in a dispensing protocol; an inventory protocol never hands anything over. An administration-log protocol never hands anything over and never gives a dose.",
      "properties": {
        "fields": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "enum": [
              "recipient_identity",
              "crewmember_on_order",
              "medicine",
              "strength",
              "dose_form",
              "quantity",
              "time_window",
              "lot",
              "location",
              "expiry",
              "storage",
              "route",
              "amount_given",
              "record_flags"
            ]
          }
        },
        "recipient_check": {
          "type": "string"
        },
        "match_label": {
          "type": "string",
          "pattern": "Not a dose"
        },
        "on_mismatch": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "hard_stop",
            "default",
            "unprompted_handoff",
            "handoff_to_anyone_but_cmo",
            "logged_as",
            "cmo_override"
          ],
          "properties": {
            "hard_stop": {
              "const": true
            },
            "default": {
              "type": "string",
              "pattern": "NOT VERIFIED"
            },
            "unprompted_handoff": {
              "const": false
            },
            "handoff_to_anyone_but_cmo": {
              "const": false
            },
            "logged_as": {
              "enum": [
                "override",
                "record-correction"
              ]
            },
            "cmo_override": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "allowed",
                "who",
                "request",
                "steps",
                "log",
                "notify_flight_surgeon",
                "statement"
              ],
              "properties": {
                "allowed": {
                  "type": "boolean"
                },
                "who": {
                  "const": "CMO"
                },
                "request": {
                  "type": "string",
                  "pattern": "[Tt]wo-step"
                },
                "steps": {
                  "type": "array",
                  "minItems": 2,
                  "items": {
                    "type": "string"
                  }
                },
                "log": {
                  "type": "array",
                  "uniqueItems": true,
                  "items": {
                    "type": "string"
                  },
                  "allOf": [
                    {
                      "contains": {
                        "const": "timestamp"
                      }
                    },
                    {
                      "contains": {
                        "const": "cmo_identity"
                      }
                    },
                    {
                      "contains": {
                        "const": "reason"
                      }
                    },
                    {
                      "contains": {
                        "const": "mismatched_fields"
                      }
                    }
                  ]
                },
                "notify_flight_surgeon": {
                  "type": "string",
                  "pattern": "flight surgeon"
                },
                "statement": {
                  "enum": [
                    "NOT VERIFIED - MISMATCH: <fields>. Override by CMO logged.",
                    "NOT VERIFIED - MISMATCH: <fields>. Record correction only; no override."
                  ]
                },
                "decided": {
                  "type": "string"
                }
              }
            }
          }
        },
        "scan_failure": {
          "type": "string",
          "pattern": "proxy"
        },
        "kind": {
          "enum": [
            "dispensing",
            "inventory",
            "administration-log",
            "controlled-count"
          ],
          "description": "dispensing (default; RMP-PHARM-001): all ten order and recipient fields. inventory (RMP-PHARM-002): no hand-over, so no order or recipient fields, and lot and location are required; the same mismatch quarantine, but cmo_override.allowed is false (a two-step record correction only). administration-log (RMP-PHARM-003): the robot logs a dose only after a human has given it, by scanning the package the crew present against the RMP-PHARM-001 order; it never gives, prepares or hands over a dose, so there is no hand-over at all and cmo_override.allowed is false (a two-step record correction only); recipient, order, medicine and lot fields are required. A controlled-count protocol (two-person blind count of controlled medicines) never hands anything over; a mismatch is a record correction only."
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "kind": {
                "enum": [
                  "inventory",
                  "controlled-count"
                ]
              }
            },
            "required": [
              "kind"
            ]
          },
          "then": {
            "properties": {
              "fields": {
                "type": "array",
                "minItems": 6,
                "not": {
                  "contains": {
                    "enum": [
                      "recipient_identity",
                      "crewmember_on_order",
                      "time_window"
                    ]
                  }
                },
                "allOf": [
                  {
                    "contains": {
                      "const": "lot"
                    }
                  },
                  {
                    "contains": {
                      "const": "location"
                    }
                  }
                ]
              },
              "on_mismatch": {
                "type": "object",
                "properties": {
                  "cmo_override": {
                    "type": "object",
                    "properties": {
                      "allowed": {
                        "const": false
                      },
                      "log": {
                        "type": "array",
                        "not": {
                          "contains": {
                            "const": "order_id"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "else": {
            "properties": {
              "fields": {
                "type": "array",
                "minItems": 10
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "kind": {
                "const": "administration-log"
              }
            },
            "required": [
              "kind"
            ]
          },
          "then": {
            "properties": {
              "fields": {
                "type": "array",
                "allOf": [
                  {
                    "contains": {
                      "const": "recipient_identity"
                    }
                  },
                  {
                    "contains": {
                      "const": "crewmember_on_order"
                    }
                  },
                  {
                    "contains": {
                      "const": "medicine"
                    }
                  },
                  {
                    "contains": {
                      "const": "strength"
                    }
                  },
                  {
                    "contains": {
                      "const": "quantity"
                    }
                  },
                  {
                    "contains": {
                      "const": "lot"
                    }
                  }
                ]
              },
              "on_mismatch": {
                "type": "object",
                "properties": {
                  "cmo_override": {
                    "type": "object",
                    "properties": {
                      "allowed": {
                        "const": false
                      }
                    }
                  }
                }
              }
            }
          }
        }
      ]
    },
    "corrections": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "date",
          "version",
          "source",
          "items"
        ],
        "properties": {
          "date": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "items": {
            "$ref": "#/$defs/strs"
          }
        }
      }
    }
  },
  "$defs": {
    "strs": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string"
      }
    },
    "actor": {
      "enum": [
        "robot",
        "crew",
        "ground"
      ]
    },
    "req": {
      "description": "NASA-STD-3001 requirement IDs that were read in Volume 1 Revision C or Volume 2 Revision F. Only verified IDs are allowed.",
      "enum": [
        "V1 3003",
        "V1 3004",
        "V1 3006",
        "V1 3007",
        "V1 3008",
        "V1 3012",
        "V1 3017",
        "V1 4003",
        "V1 4010",
        "V1 4024",
        "V1 4029",
        "V1 4030",
        "V1 4031",
        "V1 5003",
        "V1 6002",
        "V1 6003",
        "V1 6004",
        "V1 6006",
        "V1 6010",
        "V1 6011",
        "V1 7001",
        "V1 7003",
        "V2 6001",
        "V2 6004",
        "V2 6009",
        "V2 6021",
        "V2 6024",
        "V2 6025",
        "V2 6046",
        "V2 6059",
        "V2 6063",
        "V2 6109",
        "V2 6110",
        "V2 6111",
        "V2 6162",
        "V2 6164",
        "V2 7016",
        "V2 7017",
        "V2 7022",
        "V2 7038",
        "V2 7040",
        "V2 7042",
        "V2 7043",
        "V2 7045",
        "V2 7046",
        "V2 7052",
        "V2 7054",
        "V2 7055",
        "V2 7058",
        "V2 7059",
        "V2 7064",
        "V2 7070",
        "V2 7081",
        "V2 7082",
        "V2 7083",
        "V2 7102",
        "V2 8013",
        "V2 8040",
        "V2 8055",
        "V2 9053",
        "V2 9059",
        "V2 9060",
        "V2 9061",
        "V2 9062",
        "V2 9063",
        "V2 10161",
        "V2 10162",
        "V2 10163",
        "V2 10164",
        "V2 10165",
        "V2 10166",
        "V2 10167",
        "V2 10168",
        "V2 10169",
        "V2 10170",
        "V2 10171",
        "V2 10172",
        "V2 10173",
        "V2 10174",
        "V2 11032",
        "V2 11100",
        "V2 12045"
      ]
    },
    "reqs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/req"
      }
    },
    "item": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "text"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Z]{1,4}-?[0-9]+$"
        },
        "text": {
          "type": "string"
        },
        "check": {
          "type": "string"
        },
        "refs": {
          "$ref": "#/$defs/reqs"
        }
      }
    },
    "placeholderOwner": {
      "description": "Allowed owners in <set by OWNER> placeholders. The build rejects any other owner anywhere in a protocol.",
      "enum": [
        "clinical lead",
        "flight surgeon",
        "validation",
        "program environmental lead with the flight surgeon",
        "pharmacy lead"
      ]
    },
    "cmoOverride": {
      "type": "object",
      "additionalProperties": false,
      "description": "The only way a NOT VERIFIED item may be handed over: an explicit two-step request by the CMO, logged, with a flight surgeon notification.",
      "required": [
        "requested_by",
        "two_step_confirm",
        "log",
        "notify_flight_surgeon",
        "statement"
      ],
      "properties": {
        "requested_by": {
          "const": "CMO"
        },
        "two_step_confirm": {
          "const": true
        },
        "log": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "enum": [
              "timestamp",
              "cmo_identity",
              "reason",
              "mismatched_fields",
              "order_id",
              "item_barcode"
            ]
          },
          "allOf": [
            {
              "contains": {
                "const": "timestamp"
              }
            },
            {
              "contains": {
                "const": "cmo_identity"
              }
            },
            {
              "contains": {
                "const": "reason"
              }
            },
            {
              "contains": {
                "const": "mismatched_fields"
              }
            }
          ]
        },
        "notify_flight_surgeon": {
          "const": true
        },
        "statement": {
          "const": "NOT VERIFIED - MISMATCH: <fields>. Override by CMO logged."
        }
      }
    }
  }
}
