{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://opl-agentic-anatomy.netlify.app/record.schema.json",
  "title": "OPL delegation v3 interchange record",
  "description": "Structure only. The guide separately checks numeric values, dates and completeness; neither verifies evidence or authorises deployment.",
  "type": "object",
  "required": [
    "schema",
    "version",
    "exportedAt",
    "fields",
    "evidence",
    "calculator",
    "origin"
  ],
  "properties": {
    "schema": {
      "const": "opl-delegation-v3"
    },
    "version": {
      "const": 3
    },
    "exportedAt": {
      "type": "string",
      "format": "date-time"
    },
    "fields": {
      "type": "object",
      "required": [
        "name",
        "reviewBy",
        "purpose",
        "beneficiaries",
        "scope",
        "comparator",
        "role",
        "holder",
        "ops",
        "experience",
        "success",
        "escalation",
        "identity",
        "config",
        "actions",
        "exclude",
        "data",
        "approval",
        "delegation",
        "stop",
        "changes",
        "budget",
        "decision",
        "decider",
        "decisionDate",
        "conditions"
      ],
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 20000
        },
        "reviewBy": {
          "type": "string",
          "maxLength": 20000
        },
        "purpose": {
          "type": "string",
          "maxLength": 20000
        },
        "beneficiaries": {
          "type": "string",
          "maxLength": 20000
        },
        "scope": {
          "type": "string",
          "maxLength": 20000
        },
        "comparator": {
          "type": "string",
          "maxLength": 20000
        },
        "role": {
          "type": "string",
          "maxLength": 20000
        },
        "holder": {
          "type": "string",
          "maxLength": 20000
        },
        "ops": {
          "type": "string",
          "maxLength": 20000
        },
        "experience": {
          "type": "string",
          "maxLength": 20000
        },
        "success": {
          "type": "string",
          "maxLength": 20000
        },
        "escalation": {
          "type": "string",
          "maxLength": 20000
        },
        "identity": {
          "type": "string",
          "maxLength": 20000
        },
        "config": {
          "type": "string",
          "maxLength": 20000
        },
        "actions": {
          "type": "string",
          "maxLength": 20000
        },
        "exclude": {
          "type": "string",
          "maxLength": 20000
        },
        "data": {
          "type": "string",
          "maxLength": 20000
        },
        "approval": {
          "type": "string",
          "maxLength": 20000
        },
        "delegation": {
          "type": "string",
          "maxLength": 20000
        },
        "stop": {
          "type": "string",
          "maxLength": 20000
        },
        "changes": {
          "type": "string",
          "maxLength": 20000
        },
        "budget": {
          "type": "string",
          "maxLength": 20000
        },
        "decision": {
          "type": "string",
          "enum": [
            "Not recorded",
            "Gather more evidence",
            "Redesign or use a simpler process",
            "Authorise a bounded pilot",
            "Continue within stated conditions",
            "Restrict or suspend",
            "Retire"
          ]
        },
        "decider": {
          "type": "string",
          "maxLength": 20000
        },
        "decisionDate": {
          "type": "string",
          "maxLength": 20000
        },
        "conditions": {
          "type": "string",
          "maxLength": 20000
        }
      },
      "additionalProperties": false
    },
    "evidence": {
      "type": "object",
      "required": [
        "purpose",
        "competence",
        "authority",
        "safety",
        "data",
        "reliability",
        "benefit",
        "incentives",
        "portfolio",
        "change"
      ],
      "properties": {
        "purpose": {
          "type": "object",
          "required": [
            "status",
            "ref",
            "by",
            "date",
            "finding"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "unknown",
                "declared",
                "evidenced",
                "tested",
                "concern",
                "na"
              ]
            },
            "ref": {
              "type": "string",
              "maxLength": 20000
            },
            "by": {
              "type": "string",
              "maxLength": 20000
            },
            "date": {
              "type": "string",
              "maxLength": 20000
            },
            "finding": {
              "type": "string",
              "maxLength": 20000
            }
          },
          "additionalProperties": false
        },
        "competence": {
          "type": "object",
          "required": [
            "status",
            "ref",
            "by",
            "date",
            "finding"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "unknown",
                "declared",
                "evidenced",
                "tested",
                "concern",
                "na"
              ]
            },
            "ref": {
              "type": "string",
              "maxLength": 20000
            },
            "by": {
              "type": "string",
              "maxLength": 20000
            },
            "date": {
              "type": "string",
              "maxLength": 20000
            },
            "finding": {
              "type": "string",
              "maxLength": 20000
            }
          },
          "additionalProperties": false
        },
        "authority": {
          "type": "object",
          "required": [
            "status",
            "ref",
            "by",
            "date",
            "finding"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "unknown",
                "declared",
                "evidenced",
                "tested",
                "concern",
                "na"
              ]
            },
            "ref": {
              "type": "string",
              "maxLength": 20000
            },
            "by": {
              "type": "string",
              "maxLength": 20000
            },
            "date": {
              "type": "string",
              "maxLength": 20000
            },
            "finding": {
              "type": "string",
              "maxLength": 20000
            }
          },
          "additionalProperties": false
        },
        "safety": {
          "type": "object",
          "required": [
            "status",
            "ref",
            "by",
            "date",
            "finding"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "unknown",
                "declared",
                "evidenced",
                "tested",
                "concern",
                "na"
              ]
            },
            "ref": {
              "type": "string",
              "maxLength": 20000
            },
            "by": {
              "type": "string",
              "maxLength": 20000
            },
            "date": {
              "type": "string",
              "maxLength": 20000
            },
            "finding": {
              "type": "string",
              "maxLength": 20000
            }
          },
          "additionalProperties": false
        },
        "data": {
          "type": "object",
          "required": [
            "status",
            "ref",
            "by",
            "date",
            "finding"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "unknown",
                "declared",
                "evidenced",
                "tested",
                "concern",
                "na"
              ]
            },
            "ref": {
              "type": "string",
              "maxLength": 20000
            },
            "by": {
              "type": "string",
              "maxLength": 20000
            },
            "date": {
              "type": "string",
              "maxLength": 20000
            },
            "finding": {
              "type": "string",
              "maxLength": 20000
            }
          },
          "additionalProperties": false
        },
        "reliability": {
          "type": "object",
          "required": [
            "status",
            "ref",
            "by",
            "date",
            "finding"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "unknown",
                "declared",
                "evidenced",
                "tested",
                "concern",
                "na"
              ]
            },
            "ref": {
              "type": "string",
              "maxLength": 20000
            },
            "by": {
              "type": "string",
              "maxLength": 20000
            },
            "date": {
              "type": "string",
              "maxLength": 20000
            },
            "finding": {
              "type": "string",
              "maxLength": 20000
            }
          },
          "additionalProperties": false
        },
        "benefit": {
          "type": "object",
          "required": [
            "status",
            "ref",
            "by",
            "date",
            "finding"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "unknown",
                "declared",
                "evidenced",
                "tested",
                "concern",
                "na"
              ]
            },
            "ref": {
              "type": "string",
              "maxLength": 20000
            },
            "by": {
              "type": "string",
              "maxLength": 20000
            },
            "date": {
              "type": "string",
              "maxLength": 20000
            },
            "finding": {
              "type": "string",
              "maxLength": 20000
            }
          },
          "additionalProperties": false
        },
        "incentives": {
          "type": "object",
          "required": [
            "status",
            "ref",
            "by",
            "date",
            "finding"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "unknown",
                "declared",
                "evidenced",
                "tested",
                "concern",
                "na"
              ]
            },
            "ref": {
              "type": "string",
              "maxLength": 20000
            },
            "by": {
              "type": "string",
              "maxLength": 20000
            },
            "date": {
              "type": "string",
              "maxLength": 20000
            },
            "finding": {
              "type": "string",
              "maxLength": 20000
            }
          },
          "additionalProperties": false
        },
        "portfolio": {
          "type": "object",
          "required": [
            "status",
            "ref",
            "by",
            "date",
            "finding"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "unknown",
                "declared",
                "evidenced",
                "tested",
                "concern",
                "na"
              ]
            },
            "ref": {
              "type": "string",
              "maxLength": 20000
            },
            "by": {
              "type": "string",
              "maxLength": 20000
            },
            "date": {
              "type": "string",
              "maxLength": 20000
            },
            "finding": {
              "type": "string",
              "maxLength": 20000
            }
          },
          "additionalProperties": false
        },
        "change": {
          "type": "object",
          "required": [
            "status",
            "ref",
            "by",
            "date",
            "finding"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "unknown",
                "declared",
                "evidenced",
                "tested",
                "concern",
                "na"
              ]
            },
            "ref": {
              "type": "string",
              "maxLength": 20000
            },
            "by": {
              "type": "string",
              "maxLength": 20000
            },
            "date": {
              "type": "string",
              "maxLength": 20000
            },
            "finding": {
              "type": "string",
              "maxLength": 20000
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "calculator": {
      "type": "object",
      "required": [
        "volume",
        "gross",
        "review",
        "rework",
        "coord",
        "patient",
        "cost",
        "basis",
        "source"
      ],
      "properties": {
        "volume": {
          "type": "string",
          "maxLength": 20000
        },
        "gross": {
          "type": "string",
          "maxLength": 20000
        },
        "review": {
          "type": "string",
          "maxLength": 20000
        },
        "rework": {
          "type": "string",
          "maxLength": 20000
        },
        "coord": {
          "type": "string",
          "maxLength": 20000
        },
        "patient": {
          "type": "string",
          "maxLength": 20000
        },
        "cost": {
          "type": "string",
          "maxLength": 20000
        },
        "basis": {
          "type": "string",
          "enum": [
            "illustrative",
            "estimate",
            "observed"
          ]
        },
        "source": {
          "type": "string",
          "maxLength": 20000
        }
      },
      "additionalProperties": false
    },
    "origin": {
      "type": "string",
      "maxLength": 200
    }
  },
  "additionalProperties": false
}
