{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openbody.dev/schema/v0.6/openbody.schema.json",
  "title": "OpenBody record (v0.3.1)",
  "description": "JSON Schema for the OpenBody standard, primary binding (SPEC.md §§4-7). NOTE: this validates STRUCTURE. Several rules are context-dependent or normalization-level and are enforced by a CONFORMING implementation, not this schema (the reference impl openbody-ts validate() currently runs schema validation only — these remain to be added there): top-level records MUST carry id+subject while inlined children may inherit them (§7.1/§7.2); a tombstone (status:deleted) is exempt from all required fields except id/recordType/status (§7.1); a Measurement MUST carry type, startTime and endTime, with unit conditionally required by value kind (§4.1); a Session carries at most one of blocks|exercises|workUnits (§5.3); a WorkUnit's exerciseRef is mutually exclusive with an enclosing Exercise (§5.5); scoring<->metric agreement (§5.5); `sets` only in a planned prescription (§5.5); algorithm required when method=algorithm (recommended, not required, when derivedFrom present) (§7.4); and the §8.3 canonicalization/equivalence procedure. Open registry-backed tokens are typed `string` (closed enums are constrained).",
  "$ref": "#/$defs/record",
  "$defs": {
    "record": {
      "description": "Any addressable OpenBody record, discriminated by recordType.",
      "oneOf": [
        {
          "$ref": "#/$defs/tombstone"
        },
        {
          "$ref": "#/$defs/Measurement"
        },
        {
          "$ref": "#/$defs/Program"
        },
        {
          "$ref": "#/$defs/Session"
        },
        {
          "$ref": "#/$defs/Block"
        },
        {
          "$ref": "#/$defs/Exercise"
        },
        {
          "$ref": "#/$defs/WorkUnit"
        },
        {
          "$ref": "#/$defs/ThresholdProfile"
        },
        {
          "$ref": "#/$defs/StatusPeriod"
        }
      ]
    },
    "tombstone": {
      "type": "object",
      "description": "A deletion tombstone (§7.5): stripped to id/recordType/status only; exempt from all otherwise-required fields (§7.1).",
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "recordType": {
          "type": "string"
        },
        "status": {
          "const": "deleted"
        }
      },
      "required": [
        "id",
        "recordType",
        "status"
      ],
      "additionalProperties": false
    },
    "id": {
      "type": "string",
      "minLength": 1,
      "description": "Globally-unique, producer-assigned, stable. MUST NOT contain '#' (reserved for normalization-assigned ids, §8.3).",
      "not": {
        "pattern": "#"
      }
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "RFC 3339 timestamp with offset."
    },
    "fixedPoint": {
      "type": "object",
      "description": "Lossless decimal: value = coefficient x 10^exponent (§4.2).",
      "properties": {
        "coefficient": {
          "type": "integer"
        },
        "exponent": {
          "type": "integer"
        }
      },
      "required": [
        "coefficient",
        "exponent"
      ],
      "additionalProperties": false
    },
    "number": {
      "description": "A numeric value: a JSON number or a fixed-point object (§4.2).",
      "oneOf": [
        {
          "type": "number"
        },
        {
          "$ref": "#/$defs/fixedPoint"
        }
      ]
    },
    "Target": {
      "type": "object",
      "description": "Closed one-of, encoded as a single-key object whose key names the variant (§5.10). May additionally carry an `extension` key, ignored for discrimination.",
      "oneOf": [
        {
          "required": [
            "absolute"
          ],
          "properties": {
            "absolute": {
              "type": "object",
              "properties": {
                "value": {
                  "$ref": "#/$defs/number"
                },
                "unit": {
                  "type": "string"
                }
              },
              "required": [
                "value"
              ],
              "additionalProperties": false
            },
            "extension": {
              "$ref": "#/$defs/extension"
            }
          },
          "additionalProperties": false
        },
        {
          "required": [
            "range"
          ],
          "properties": {
            "range": {
              "type": "object",
              "properties": {
                "min": {
                  "$ref": "#/$defs/number"
                },
                "max": {
                  "$ref": "#/$defs/number"
                },
                "unit": {
                  "type": "string"
                }
              },
              "required": [
                "min",
                "max"
              ],
              "additionalProperties": false
            },
            "extension": {
              "$ref": "#/$defs/extension"
            }
          },
          "additionalProperties": false
        },
        {
          "required": [
            "relativeToThreshold"
          ],
          "properties": {
            "relativeToThreshold": {
              "type": "object",
              "description": "Relative to a ThresholdProfile entry (§5.10/§5.11). Exactly one of `percent` (single) or `min`+`max` (a relative band / training zone).",
              "properties": {
                "percent": {
                  "type": "number"
                },
                "min": {
                  "type": "number"
                },
                "max": {
                  "type": "number"
                },
                "of": {
                  "type": "string"
                },
                "ref": {
                  "$ref": "#/$defs/id"
                }
              },
              "required": [
                "of"
              ],
              "oneOf": [
                { "required": ["percent"] },
                { "required": ["min", "max"] }
              ],
              "additionalProperties": false
            },
            "extension": {
              "$ref": "#/$defs/extension"
            }
          },
          "additionalProperties": false
        },
        {
          "required": [
            "stopCondition"
          ],
          "properties": {
            "stopCondition": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "value": {
                  "$ref": "#/$defs/number"
                }
              },
              "required": [
                "kind"
              ],
              "additionalProperties": false
            },
            "extension": {
              "$ref": "#/$defs/extension"
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "scalarOrTarget": {
      "description": "A metric value: a bare scalar (shorthand for {absolute:{value}}) or a Target (§5.10).",
      "oneOf": [
        {
          "$ref": "#/$defs/number"
        },
        {
          "$ref": "#/$defs/Target"
        }
      ]
    },
    "extension": {
      "type": "object",
      "description": "Namespaced passthrough, keyed by namespace (reverse-DNS or a registry prefix); each value an arbitrary object (§8.1).",
      "additionalProperties": {
        "type": "object"
      }
    },
    "Load": {
      "type": "object",
      "description": "External resistance (§5.12). `unit` is required for scalar/absolute/range value, omitted for relativeToThreshold/stopCondition (enforced in code).",
      "properties": {
        "value": {
          "$ref": "#/$defs/scalarOrTarget"
        },
        "unit": {
          "type": "string"
        },
        "basis": {
          "type": "string"
        }
      },
      "required": [
        "value"
      ],
      "additionalProperties": false
    },
    "EffortLoad": {
      "type": "object",
      "description": "Plural effort measure (§5.13). Exactly one of value|range.",
      "properties": {
        "kind": {
          "enum": [
            "external",
            "internal"
          ]
        },
        "method": {
          "type": "string"
        },
        "value": {
          "type": "number"
        },
        "range": {
          "type": "object",
          "properties": {
            "min": {
              "type": "number"
            },
            "max": {
              "type": "number"
            }
          },
          "required": [
            "min",
            "max"
          ],
          "additionalProperties": false
        },
        "unit": {
          "type": "string"
        },
        "source": {
          "enum": [
            "manual",
            "estimated"
          ]
        }
      },
      "required": [
        "kind",
        "method"
      ],
      "oneOf": [
        {
          "required": [
            "value"
          ]
        },
        {
          "required": [
            "range"
          ]
        }
      ],
      "additionalProperties": false
    },
    "Intensity": {
      "type": "object",
      "description": "A non-resistance intensity target (§5.13): power/pace/HR/speed/grade, as an absolute value, a relative-to-threshold value or band, or a named zone. Exactly one of `value` or `zone`.",
      "properties": {
        "dimension": {
          "type": "string"
        },
        "value": {
          "$ref": "#/$defs/scalarOrTarget"
        },
        "zone": {
          "type": "string"
        },
        "unit": {
          "type": "string"
        },
        "extension": {
          "$ref": "#/$defs/extension"
        }
      },
      "required": [
        "dimension"
      ],
      "oneOf": [
        { "required": ["value"] },
        { "required": ["zone"] }
      ],
      "additionalProperties": false
    },
    "Progression": {
      "type": "object",
      "description": "Declarative advancement rule + optional opaque script (§5.14).",
      "properties": {
        "rule": {
          "type": "string"
        },
        "params": {
          "type": "object"
        },
        "script": {
          "type": "object"
        }
      },
      "required": [
        "rule"
      ],
      "additionalProperties": false
    },
    "phasePattern": {
      "type": "array",
      "description": "Ordered named phases; generalizes tempo and breath work (§5.15).",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "durationSec": {
            "$ref": "#/$defs/number"
          },
          "ratio": {
            "$ref": "#/$defs/number"
          },
          "qualifier": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      }
    },
    "Descriptors": {
      "type": "object",
      "description": "Occurrence's concrete realization (§5.16).",
      "properties": {
        "equipment": {
          "type": "object",
          "properties": {
            "manufacturer": {
              "type": "string"
            },
            "model": {
              "type": "string"
            },
            "settings": {
              "type": "object"
            }
          },
          "additionalProperties": false
        },
        "resistanceProfile": {
          "enum": [
            "constant",
            "variable",
            "accommodating"
          ]
        }
      },
      "additionalProperties": false
    },
    "modifiers": {
      "type": "array",
      "description": "Open, typed list of conditions (§5.17).",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "value": {
            "type": [
              "number",
              "string"
            ]
          },
          "unit": {
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "additionalProperties": false
      }
    },
    "outcome": {
      "type": "object",
      "description": "Skill/sport/game result (§5.18).",
      "properties": {
        "kind": {
          "enum": [
            "score",
            "points",
            "placement",
            "success",
            "grade"
          ]
        },
        "value": {
          "type": [
            "number",
            "boolean",
            "string"
          ]
        },
        "unit": {
          "type": "string"
        },
        "attempts": {
          "type": "object",
          "properties": {
            "made": {
              "type": "integer"
            },
            "attempted": {
              "type": "integer"
            }
          },
          "additionalProperties": false
        },
        "components": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "value": {
                "type": "number"
              },
              "weight": {
                "type": "number"
              }
            },
            "required": [
              "name",
              "value"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "kind",
        "value"
      ],
      "additionalProperties": false
    },
    "ExerciseRef": {
      "description": "Movement reference: a bare canonical-id string, or the full object (§6).",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "registry": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "version": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            },
            "facets": {
              "type": "object"
            },
            "coded": {
              "type": "object"
            },
            "opaque": {
              "type": "string"
            },
            "extension": {
              "$ref": "#/$defs/extension"
            }
          },
          "anyOf": [
            {
              "required": [
                "id"
              ]
            },
            {
              "required": [
                "opaque"
              ]
            }
          ],
          "additionalProperties": false
        }
      ]
    },
    "link": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "Closed core relations (§7.2); namespaced strings allowed for extension links.",
          "examples": [
            "partOf",
            "sameActivityAs",
            "derivedFrom",
            "peerSensor",
            "measuredBy",
            "performedFrom",
            "groupActivity"
          ]
        },
        "ref": {
          "type": "string"
        }
      },
      "required": [
        "type",
        "ref"
      ],
      "additionalProperties": false
    },
    "provenance": {
      "type": "object",
      "properties": {
        "method": {
          "enum": [
            "manual",
            "sensor",
            "estimated",
            "algorithm"
          ]
        },
        "device": {
          "type": "object",
          "properties": {
            "manufacturer": {
              "type": "string"
            },
            "model": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "sourceApp": {
          "type": "string"
        },
        "algorithm": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "version": {
              "type": "string"
            }
          },
          "required": [
            "name",
            "version"
          ],
          "additionalProperties": false
        },
        "confidence": {
          "type": "number"
        }
      },
      "additionalProperties": false
    },
    "envelope": {
      "description": "Shared envelope fields (§7). Composed into every record.",
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "recordType": {
          "type": "string"
        },
        "subject": {
          "type": "string"
        },
        "clientRecordId": {
          "type": "string"
        },
        "links": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/link"
          }
        },
        "provenance": {
          "$ref": "#/$defs/provenance"
        },
        "status": {
          "enum": [
            "active",
            "superseded",
            "deleted"
          ]
        },
        "supersedes": {
          "type": "string"
        },
        "revision": {
          "type": "integer"
        },
        "extension": {
          "$ref": "#/$defs/extension"
        }
      }
    },
    "prescription": {
      "type": "object",
      "description": "Planned modular fields (§5.5). `sets` is planned-only shorthand.",
      "properties": {
        "reps": {
          "$ref": "#/$defs/scalarOrTarget"
        },
        "time": {
          "$ref": "#/$defs/scalarOrTarget"
        },
        "distance": {
          "$ref": "#/$defs/scalarOrTarget"
        },
        "energy": {
          "$ref": "#/$defs/scalarOrTarget"
        },
        "load": {
          "$ref": "#/$defs/Load"
        },
        "effortLoad": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/EffortLoad"
          }
        },
        "intensity": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Intensity"
          }
        },
        "rest": {
          "$ref": "#/$defs/scalarOrTarget"
        },
        "phasePattern": {
          "$ref": "#/$defs/phasePattern"
        },
        "modifiers": {
          "$ref": "#/$defs/modifiers"
        },
        "progression": {
          "$ref": "#/$defs/Progression"
        },
        "sets": {
          "type": "integer",
          "minimum": 1
        }
      },
      "additionalProperties": false
    },
    "performance": {
      "type": "object",
      "description": "Performed modular fields (§5.5): same as prescription minus `sets`, plus `outcome`.",
      "properties": {
        "reps": {
          "$ref": "#/$defs/scalarOrTarget"
        },
        "time": {
          "$ref": "#/$defs/scalarOrTarget"
        },
        "distance": {
          "$ref": "#/$defs/scalarOrTarget"
        },
        "energy": {
          "$ref": "#/$defs/scalarOrTarget"
        },
        "load": {
          "$ref": "#/$defs/Load"
        },
        "effortLoad": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/EffortLoad"
          }
        },
        "intensity": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Intensity"
          }
        },
        "rest": {
          "$ref": "#/$defs/scalarOrTarget"
        },
        "phasePattern": {
          "$ref": "#/$defs/phasePattern"
        },
        "modifiers": {
          "$ref": "#/$defs/modifiers"
        },
        "outcome": {
          "$ref": "#/$defs/outcome"
        }
      },
      "additionalProperties": false
    },
    "Rep": {
      "type": "object",
      "description": "Per-rep detail element (§5.7).",
      "properties": {
        "velocity": {
          "$ref": "#/$defs/scalarOrTarget"
        },
        "rangeOfMotion": {
          "$ref": "#/$defs/scalarOrTarget"
        },
        "phasePattern": {
          "$ref": "#/$defs/phasePattern"
        },
        "outcome": {
          "$ref": "#/$defs/outcome"
        }
      },
      "additionalProperties": false
    },
    "Measurement": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/envelope"
        }
      ],
      "properties": {
        "id": true,
        "subject": true,
        "clientRecordId": true,
        "links": true,
        "provenance": true,
        "status": true,
        "supersedes": true,
        "revision": true,
        "extension": true,
        "recordType": {
          "const": "Measurement"
        },
        "type": {
          "type": "string"
        },
        "unit": {
          "type": "string"
        },
        "startTime": {
          "$ref": "#/$defs/timestamp"
        },
        "endTime": {
          "$ref": "#/$defs/timestamp"
        },
        "quantity": {
          "$ref": "#/$defs/number"
        },
        "category": {
          "type": "string"
        },
        "sampleArray": {
          "type": "object",
          "properties": {
            "frequencyHz": {
              "type": "number"
            },
            "offsets": {
              "type": "array",
              "items": {
                "type": "number"
              }
            },
            "channels": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "unit": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "unit"
                ],
                "additionalProperties": false
              }
            },
            "dataPoints": {
              "type": "array"
            }
          },
          "oneOf": [
            {
              "required": [
                "frequencyHz"
              ],
              "not": {
                "required": [
                  "offsets"
                ]
              }
            },
            {
              "required": [
                "offsets"
              ],
              "not": {
                "required": [
                  "frequencyHz"
                ]
              }
            }
          ],
          "required": [
            "dataPoints"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "recordType",
        "type"
      ],
      "oneOf": [
        {
          "required": [
            "quantity"
          ]
        },
        {
          "required": [
            "category"
          ]
        },
        {
          "required": [
            "sampleArray"
          ]
        }
      ],
      "additionalProperties": false
    },
    "Program": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/envelope"
        }
      ],
      "properties": {
        "id": true,
        "subject": true,
        "clientRecordId": true,
        "links": true,
        "provenance": true,
        "status": true,
        "supersedes": true,
        "revision": true,
        "extension": true,
        "recordType": {
          "const": "Program"
        },
        "sessions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "recurrence": {
          "type": "object",
          "properties": {
            "rule": {
              "type": "string"
            },
            "count": {
              "type": "integer"
            }
          },
          "required": [
            "rule"
          ],
          "additionalProperties": false
        },
        "iteration": {
          "type": "integer"
        },
        "progression": {
          "$ref": "#/$defs/Progression"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "recordType"
      ],
      "additionalProperties": false
    },
    "Session": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/envelope"
        }
      ],
      "properties": {
        "id": true,
        "subject": true,
        "clientRecordId": true,
        "links": true,
        "provenance": true,
        "status": true,
        "supersedes": true,
        "revision": true,
        "extension": true,
        "recordType": {
          "const": "Session"
        },
        "startTime": {
          "$ref": "#/$defs/timestamp"
        },
        "endTime": {
          "$ref": "#/$defs/timestamp"
        },
        "disciplines": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "intent": {
          "enum": [
            "train",
            "test",
            "compete",
            "recover",
            "rehab"
          ]
        },
        "qualities": {
          "type": "array",
          "description": "Physical quality/qualities this session develops (§5.3, R20) — open registry-backed tokens; orthogonal to disciplines and intent.",
          "items": {
            "type": "string"
          }
        },
        "participants": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Participant"
          }
        },
        "accumulation": {
          "type": "boolean"
        },
        "blocks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Block"
          }
        },
        "exercises": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Exercise"
          }
        },
        "workUnits": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WorkUnit"
          }
        },
        "name": {
          "type": "string"
        },
        "notes": {
          "type": "string"
        },
        "outcome": {
          "$ref": "#/$defs/outcome"
        }
      },
      "required": [
        "recordType"
      ],
      "additionalProperties": false
    },
    "Block": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/envelope"
        },
        {
          "not": {
            "required": [
              "repetitions",
              "roundScheme"
            ]
          }
        }
      ],
      "properties": {
        "id": true,
        "subject": true,
        "clientRecordId": true,
        "links": true,
        "provenance": true,
        "status": true,
        "supersedes": true,
        "revision": true,
        "extension": true,
        "recordType": {
          "const": "Block"
        },
        "startTime": {
          "$ref": "#/$defs/timestamp"
        },
        "endTime": {
          "$ref": "#/$defs/timestamp"
        },
        "children": {
          "type": "array",
          "description": "Inlined in the nested form; omitted in the flat+partOf form, where children are separate records (§7.2).",
          "items": {
            "oneOf": [
              {
                "$ref": "#/$defs/Block"
              },
              {
                "$ref": "#/$defs/Exercise"
              },
              {
                "$ref": "#/$defs/WorkUnit"
              }
            ]
          }
        },
        "repetitions": {
          "type": "integer"
        },
        "roundScheme": {
          "type": "array",
          "description": "Laddered rounds (§5.4): per-round counts (e.g. [21,15,9]). Planned shorthand; expands on normalization (§8.3 step 5). Mutually exclusive with `repetitions` (enforced by the Block `not` constraint).",
          "items": {
            "type": "integer"
          },
          "minItems": 1
        },
        "scoring": {
          "type": "object",
          "properties": {
            "scheme": {
              "type": "string"
            },
            "timeCapSec": {
              "type": "number"
            },
            "intervalSec": {
              "type": "number"
            },
            "workSec": {
              "type": "number"
            },
            "restSec": {
              "type": "number"
            },
            "rounds": {
              "type": "integer"
            }
          },
          "required": [
            "scheme"
          ],
          "additionalProperties": false
        },
        "grouping": {
          "type": "string"
        },
        "qualities": {
          "type": "array",
          "description": "Physical quality/qualities this block develops (§5.4, R20) — same open vocabulary as Session.qualities, at block granularity.",
          "items": {
            "type": "string"
          }
        },
        "performance": {
          "type": "object",
          "properties": {
            "outcome": {
              "$ref": "#/$defs/outcome"
            },
            "time": {
              "$ref": "#/$defs/scalarOrTarget"
            },
            "rxStatus": {
              "enum": [
                "rx",
                "scaled"
              ]
            }
          },
          "additionalProperties": false
        },
        "rxStatus": {
          "enum": [
            "rx",
            "scaled"
          ]
        },
        "synchronized": {
          "type": "boolean"
        },
        "name": {
          "type": "string"
        },
        "notes": {
          "type": "string"
        }
      },
      "required": [
        "recordType"
      ],
      "additionalProperties": false
    },
    "Exercise": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/envelope"
        }
      ],
      "properties": {
        "id": true,
        "subject": true,
        "clientRecordId": true,
        "links": true,
        "provenance": true,
        "status": true,
        "supersedes": true,
        "revision": true,
        "extension": true,
        "recordType": {
          "const": "Exercise"
        },
        "exerciseRef": {
          "$ref": "#/$defs/ExerciseRef"
        },
        "descriptors": {
          "$ref": "#/$defs/Descriptors"
        },
        "workUnits": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WorkUnit"
          },
          "description": "Inlined in the nested form; omitted in the flat+partOf form (§7.2)."
        },
        "notes": {
          "type": "string"
        }
      },
      "required": [
        "recordType",
        "exerciseRef"
      ],
      "additionalProperties": false
    },
    "WorkUnit": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/envelope"
        }
      ],
      "properties": {
        "id": true,
        "subject": true,
        "clientRecordId": true,
        "links": true,
        "provenance": true,
        "status": true,
        "supersedes": true,
        "revision": true,
        "extension": true,
        "recordType": {
          "const": "WorkUnit"
        },
        "scoring": {
          "enum": [
            "reps",
            "time",
            "distance",
            "continuous",
            "energy"
          ]
        },
        "exerciseRef": {
          "$ref": "#/$defs/ExerciseRef"
        },
        "prescription": {
          "$ref": "#/$defs/prescription"
        },
        "performance": {
          "$ref": "#/$defs/performance"
        },
        "setRole": {
          "type": "string"
        },
        "rxStatus": {
          "enum": [
            "rx",
            "scaled"
          ]
        },
        "by": {
          "type": "string"
        },
        "synchronized": {
          "type": "boolean"
        },
        "repDetail": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Rep"
          }
        },
        "startTime": {
          "$ref": "#/$defs/timestamp"
        },
        "endTime": {
          "$ref": "#/$defs/timestamp"
        },
        "notes": {
          "type": "string"
        }
      },
      "required": [
        "recordType",
        "scoring"
      ],
      "additionalProperties": false
    },
    "Participant": {
      "type": "object",
      "properties": {
        "ref": {
          "type": "string"
        },
        "subjectType": {
          "enum": [
            "human",
            "animal",
            "team"
          ]
        },
        "species": {
          "type": "string"
        },
        "breed": {
          "type": "string"
        },
        "role": {
          "type": "string"
        }
      },
      "required": [
        "ref"
      ],
      "additionalProperties": false
    },
    "ThresholdProfile": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/envelope"
        }
      ],
      "properties": {
        "id": true,
        "subject": true,
        "clientRecordId": true,
        "links": true,
        "provenance": true,
        "status": true,
        "supersedes": true,
        "revision": true,
        "extension": true,
        "recordType": {
          "const": "ThresholdProfile"
        },
        "entries": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string"
              },
              "value": {
                "type": "number"
              },
              "unit": {
                "type": "string"
              },
              "for": {
                "type": "string"
              },
              "asOf": {
                "$ref": "#/$defs/timestamp"
              },
              "source": {
                "enum": [
                  "tested",
                  "estimated"
                ]
              },
              "confidence": {
                "type": "number"
              }
            },
            "required": [
              "kind",
              "value",
              "unit"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "recordType",
        "entries"
      ],
      "additionalProperties": false
    },
    "StatusPeriod": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/envelope"
        }
      ],
      "properties": {
        "id": true,
        "subject": true,
        "clientRecordId": true,
        "links": true,
        "provenance": true,
        "status": true,
        "supersedes": true,
        "revision": true,
        "extension": true,
        "recordType": {
          "const": "StatusPeriod"
        },
        "type": {
          "type": "string"
        },
        "from": {
          "$ref": "#/$defs/timestamp"
        },
        "to": {
          "$ref": "#/$defs/timestamp"
        },
        "note": {
          "type": "string"
        }
      },
      "required": [
        "recordType",
        "type",
        "from"
      ],
      "additionalProperties": false
    }
  }
}
