{
  "openapi": "3.1.0",
  "info": {
    "title": "Care MCP API",
    "version": "1",
    "description": "Order written training and nutrition plans, evaluations and plan reviews from certified professionals. Every endpoint, with a complete example, is also at /api.",
    "contact": {
      "email": "caremcp@portfoliobox.net"
    }
  },
  "servers": [
    {
      "url": "https://caremcp.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "tags": [
    {
      "name": "public"
    },
    {
      "name": "client"
    },
    {
      "name": "organisation"
    },
    {
      "name": "professional"
    },
    {
      "name": "operator"
    }
  ],
  "paths": {
    "/api/public/catalog": {
      "get": {
        "operationId": "public.catalog",
        "tags": [
          "public"
        ],
        "summary": "What can be ordered: the protocols, the professions with what each answers and requires, every standard with its source, the prices and the bundles.",
        "security": [],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "protocols": {
                      "type": "array",
                      "items": {}
                    },
                    "professions": {
                      "type": "array",
                      "items": {}
                    },
                    "standards": {
                      "type": "array",
                      "items": {}
                    },
                    "prices": {
                      "type": "array",
                      "items": {}
                    },
                    "together": {
                      "type": "array",
                      "items": {}
                    }
                  },
                  "required": [
                    "protocols",
                    "professions",
                    "standards",
                    "prices",
                    "together"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/public/clients/sign-up": {
      "post": {
        "operationId": "public.client.signUp",
        "tags": [
          "public"
        ],
        "summary": "A client account by email and password. The page uses Apple or Google instead; this is the API's way.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "maxLength": 200,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 200
                  },
                  "birthDate": {
                    "type": "string",
                    "format": "date",
                    "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])))$"
                  },
                  "location": {
                    "type": "object",
                    "properties": {
                      "country": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$"
                      },
                      "region": {
                        "type": "string",
                        "pattern": "^[A-Z0-9]{1,3}$"
                      }
                    },
                    "required": [
                      "country"
                    ]
                  },
                  "language": {
                    "type": "string",
                    "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                  },
                  "healthConsent": {
                    "type": "boolean",
                    "const": true,
                    "description": "The client has read the Health data notice at /health-data (version 2026-09-24) and gives explicit consent to a professional reading the health data in their briefs."
                  }
                },
                "required": [
                  "email",
                  "password",
                  "birthDate",
                  "location",
                  "language",
                  "healthConsent"
                ]
              },
              "example": {
                "email": "anna@example.com",
                "password": "a long enough password",
                "birthDate": "1984-03-12",
                "location": {
                  "country": "SE"
                },
                "language": "sv",
                "healthConsent": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "client",
                        "professional",
                        "organisation"
                      ]
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "token",
                    "kind",
                    "id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/public/clients/sign-in": {
      "post": {
        "operationId": "public.client.signIn",
        "tags": [
          "public"
        ],
        "summary": "A session for a client with an email and password.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "maxLength": 200,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 200
                  }
                },
                "required": [
                  "email",
                  "password"
                ]
              },
              "example": {
                "email": "anna@example.com",
                "password": "a long enough password"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "client",
                        "professional",
                        "organisation"
                      ]
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "token",
                    "kind",
                    "id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/public/professionals/apply": {
      "post": {
        "operationId": "public.professional.apply",
        "tags": [
          "public"
        ],
        "summary": "A professional applies: the account is made and signed in, and the pool opens once we have approved it.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "maxLength": 200,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 200
                  },
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 100
                  },
                  "location": {
                    "type": "object",
                    "properties": {
                      "country": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$"
                      },
                      "region": {
                        "type": "string",
                        "pattern": "^[A-Z0-9]{1,3}$"
                      }
                    },
                    "required": [
                      "country"
                    ]
                  },
                  "languages": {
                    "minItems": 1,
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                    }
                  },
                  "professions": {
                    "minItems": 1,
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "licensedIn": {
                    "default": [],
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Z]{2}$"
                    }
                  }
                },
                "required": [
                  "email",
                  "password",
                  "name",
                  "location",
                  "languages",
                  "professions"
                ]
              },
              "example": {
                "email": "vera@example.com",
                "password": "a long enough password",
                "name": "Vera Lind",
                "location": {
                  "country": "SE"
                },
                "languages": [
                  "sv",
                  "en"
                ],
                "professions": [
                  "personal-trainer",
                  "nutrition-coach"
                ],
                "licensedIn": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "client",
                        "professional",
                        "organisation"
                      ]
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "token",
                    "kind",
                    "id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/public/professionals/sign-in": {
      "post": {
        "operationId": "public.professional.signIn",
        "tags": [
          "public"
        ],
        "summary": "A session for a professional.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "maxLength": 200,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 200
                  }
                },
                "required": [
                  "email",
                  "password"
                ]
              },
              "example": {
                "email": "vera@example.com",
                "password": "a long enough password"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "client",
                        "professional",
                        "organisation"
                      ]
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "token",
                    "kind",
                    "id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/public/organisations/sign-up": {
      "post": {
        "operationId": "public.organisation.signUp",
        "tags": [
          "public"
        ],
        "summary": "An organisation account: a company whose pot pays for its clients.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 120
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 200,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 200
                  },
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Z]{2}$"
                  }
                },
                "required": [
                  "name",
                  "email",
                  "password",
                  "country"
                ]
              },
              "example": {
                "name": "Agent Heim",
                "email": "ops@agentheim.com",
                "password": "a long enough password",
                "country": "SE"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "client",
                        "professional",
                        "organisation"
                      ]
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "token",
                    "kind",
                    "id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/public/organisations/sign-in": {
      "post": {
        "operationId": "public.organisation.signIn",
        "tags": [
          "public"
        ],
        "summary": "A session for an organisation.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "maxLength": 200,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 200
                  }
                },
                "required": [
                  "email",
                  "password"
                ]
              },
              "example": {
                "email": "ops@agentheim.com",
                "password": "a long enough password"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "client",
                        "professional",
                        "organisation"
                      ]
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "token",
                    "kind",
                    "id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/public/contact": {
      "post": {
        "operationId": "public.contact",
        "tags": [
          "public"
        ],
        "summary": "A message to us from the contact page: who, how to answer, what it is about. It arrives as mail and a person answers.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 200,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "topic": {
                    "type": "string",
                    "enum": [
                      "personal",
                      "professional",
                      "organisation",
                      "press",
                      "other"
                    ],
                    "description": "What the message is about."
                  },
                  "message": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 5000
                  },
                  "website": {
                    "type": "string",
                    "maxLength": 0
                  }
                },
                "required": [
                  "name",
                  "email",
                  "topic",
                  "message"
                ]
              },
              "example": {
                "name": "Anna Lind",
                "email": "anna@example.com",
                "topic": "personal",
                "message": "Can my agent order a plan for a half marathon in March?"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/public/professionals/interest": {
      "post": {
        "operationId": "public.professional.interest",
        "tags": [
          "public"
        ],
        "summary": "An application to write for Care MCP from the apply page: who, how to reach them, why, what they are certified in and what else they have studied. It arrives as mail; we vet it and answer.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 200,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "linkedin": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300,
                        "format": "uri"
                      },
                      {
                        "type": "string",
                        "const": ""
                      }
                    ]
                  },
                  "country": {
                    "type": "string",
                    "maxLength": 60
                  },
                  "certifiedTrainer": {
                    "default": false,
                    "description": "Certified personal trainer.",
                    "type": "boolean"
                  },
                  "certifiedNutrition": {
                    "default": false,
                    "description": "Certified nutrition coach.",
                    "type": "boolean"
                  },
                  "education": {
                    "description": "Other certificates and education.",
                    "type": "string",
                    "maxLength": 3000
                  },
                  "why": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 3000,
                    "description": "Why they want to write for Care MCP."
                  },
                  "website": {
                    "type": "string",
                    "maxLength": 0
                  }
                },
                "required": [
                  "name",
                  "email",
                  "why"
                ]
              },
              "example": {
                "name": "Vera Lind",
                "email": "vera@example.com",
                "linkedin": "https://www.linkedin.com/in/veralind",
                "country": "Sweden",
                "certifiedTrainer": true,
                "certifiedNutrition": false,
                "education": "BSc in sport science, kettlebell instructor",
                "why": "I coach runners over fifty and want to reach more of them."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/public/sign-out": {
      "post": {
        "operationId": "public.signOut",
        "tags": [
          "public"
        ],
        "summary": "Ends the session the bearer names. Without one, nothing happens.",
        "security": [],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/client/me": {
      "get": {
        "operationId": "client.me",
        "tags": [
          "client"
        ],
        "summary": "The signed-in client.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "email": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "birthDate": {
                      "type": "string",
                      "format": "date",
                      "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])))$"
                    },
                    "location": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string",
                          "pattern": "^[A-Z]{2}$"
                        },
                        "region": {
                          "type": "string",
                          "pattern": "^[A-Z0-9]{1,3}$"
                        }
                      },
                      "required": [
                        "country"
                      ],
                      "additionalProperties": false
                    },
                    "language": {
                      "type": "string",
                      "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "healthConsent": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "version": {
                              "type": "string"
                            },
                            "at": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "version",
                            "at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organisationId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "birthDate",
                    "location",
                    "language",
                    "currency",
                    "healthConsent",
                    "organisationId",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "client.update",
        "tags": [
          "client"
        ],
        "summary": "Birth date, location, language, email, and the health data notice agreed to. The rules read the first three on every order; no order is placed until the notice is agreed.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "birthDate": {
                    "type": "string",
                    "format": "date",
                    "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])))$"
                  },
                  "location": {
                    "type": "object",
                    "properties": {
                      "country": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$"
                      },
                      "region": {
                        "type": "string",
                        "pattern": "^[A-Z0-9]{1,3}$"
                      }
                    },
                    "required": [
                      "country"
                    ]
                  },
                  "language": {
                    "type": "string",
                    "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                  },
                  "email": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200,
                        "format": "email",
                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "healthConsent": {
                    "type": "boolean",
                    "const": true,
                    "description": "The client has read the Health data notice at /health-data (version 2026-09-24) and gives explicit consent to a professional reading the health data in their briefs."
                  }
                }
              },
              "example": {
                "language": "en",
                "healthConsent": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "email": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "birthDate": {
                      "type": "string",
                      "format": "date",
                      "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])))$"
                    },
                    "location": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string",
                          "pattern": "^[A-Z]{2}$"
                        },
                        "region": {
                          "type": "string",
                          "pattern": "^[A-Z0-9]{1,3}$"
                        }
                      },
                      "required": [
                        "country"
                      ],
                      "additionalProperties": false
                    },
                    "language": {
                      "type": "string",
                      "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "healthConsent": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "version": {
                              "type": "string"
                            },
                            "at": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "version",
                            "at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organisationId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "birthDate",
                    "location",
                    "language",
                    "currency",
                    "healthConsent",
                    "organisationId",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "client.delete",
        "tags": [
          "client"
        ],
        "summary": "Deletes the account: the email, birth date and sign-ins are erased, every agent's access revoked, every order's brief and document replaced by nothing, an open order refused. Charges and receipts stay for the books and carry no name.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/client/balance": {
      "get": {
        "operationId": "client.balance",
        "tags": [
          "client"
        ],
        "summary": "The pot: credits, charged, reserved by open orders, available. A client an organisation pays for sees only what is available.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "paidBy": {
                      "type": "string",
                      "enum": [
                        "self",
                        "organisation"
                      ]
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "charged": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "reserved": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "available": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "paidBy",
                    "currency",
                    "credits",
                    "charged",
                    "reserved",
                    "available"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/client/statement": {
      "get": {
        "operationId": "client.statement",
        "tags": [
          "client"
        ],
        "summary": "Every deposit and every delivered order with its price, newest first.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "credit",
                          "charge"
                        ]
                      },
                      "amountCents": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "ref": {
                        "type": "string"
                      },
                      "clientRef": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "description": {
                        "type": "string"
                      },
                      "at": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "kind",
                      "amountCents",
                      "ref",
                      "clientRef",
                      "description",
                      "at"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/client/deposits": {
      "get": {
        "operationId": "client.deposits.list",
        "tags": [
          "client"
        ],
        "summary": "The deposits paid through the provider, each with its receipt: net, tax and total in the client's currency.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "ref": {
                        "type": "string"
                      },
                      "receiptNumber": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "currency": {
                        "type": "string",
                        "enum": [
                          "USD",
                          "EUR"
                        ]
                      },
                      "amountCents": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "taxPercent": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "taxCents": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "totalCents": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "at": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "ref",
                      "receiptNumber",
                      "currency",
                      "amountCents",
                      "taxPercent",
                      "taxCents",
                      "totalCents",
                      "at"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "client.deposit.start",
        "tags": [
          "client"
        ],
        "summary": "Starts a deposit with the payment provider and answers the page to pay on, with the tax added for the client's country. The pot is credited the net amount when the provider confirms; the receipt goes by mail.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amountCents": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 500000,
                    "description": "Cents in the client's currency, net of tax; 10 to 5000 dollars or euro."
                  },
                  "returnUrl": {
                    "description": "Where the provider sends the client afterwards.",
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": [
                  "amountCents"
                ]
              },
              "example": {
                "amountCents": 5000,
                "returnUrl": "https://agent.example/back"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "ref": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "amountCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "taxPercent": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "taxCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "totalCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "url",
                    "ref",
                    "currency",
                    "amountCents",
                    "taxPercent",
                    "taxCents",
                    "totalCents"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/client/receipts": {
      "get": {
        "operationId": "client.receipts",
        "tags": [
          "client"
        ],
        "summary": "The provider's page with the client's receipts, when the provider has one; null otherwise, and the receipts are in the deposits.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "url"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/client/orders": {
      "get": {
        "operationId": "client.orders.list",
        "tags": [
          "client"
        ],
        "summary": "Every order, newest first, with the review once there is one.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "protocol": {
                        "type": "string"
                      },
                      "professions": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "queued",
                          "assigned",
                          "reviewed",
                          "refused"
                        ]
                      },
                      "screening": {
                        "type": "object",
                        "properties": {
                          "tier": {
                            "anyOf": [
                              {
                                "type": "number",
                                "const": 1
                              },
                              {
                                "type": "number",
                                "const": 2
                              },
                              {
                                "type": "number",
                                "const": 3
                              }
                            ]
                          },
                          "flags": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "tier",
                          "flags"
                        ],
                        "additionalProperties": false
                      },
                      "verdict": {
                        "type": "object",
                        "properties": {
                          "ok": {
                            "type": "boolean"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "refused",
                              "clearance"
                            ]
                          },
                          "reason": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "ok"
                        ],
                        "additionalProperties": false
                      },
                      "professionalId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "review": {
                        "anyOf": [
                          {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "object",
                              "properties": {
                                "markdown": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "markdown"
                              ],
                              "additionalProperties": false
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "priceCents": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "currency": {
                        "type": "string",
                        "enum": [
                          "USD",
                          "EUR"
                        ]
                      },
                      "createdAt": {
                        "type": "string"
                      },
                      "claimedAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "reviewedAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "protocol",
                      "professions",
                      "status",
                      "screening",
                      "verdict",
                      "professionalId",
                      "review",
                      "priceCents",
                      "currency",
                      "createdAt",
                      "claimedAt",
                      "reviewedAt"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/client/orders/{id}": {
      "get": {
        "operationId": "client.orders.get",
        "tags": [
          "client"
        ],
        "summary": "One order and its review. This is the page the mail links to.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string"
                    },
                    "professions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "assigned",
                        "reviewed",
                        "refused"
                      ]
                    },
                    "screening": {
                      "type": "object",
                      "properties": {
                        "tier": {
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 1
                            },
                            {
                              "type": "number",
                              "const": 2
                            },
                            {
                              "type": "number",
                              "const": 3
                            }
                          ]
                        },
                        "flags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "tier",
                        "flags"
                      ],
                      "additionalProperties": false
                    },
                    "verdict": {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "refused",
                            "clearance"
                          ]
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "ok"
                      ],
                      "additionalProperties": false
                    },
                    "professionalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "review": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "markdown": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "markdown"
                            ],
                            "additionalProperties": false
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "priceCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reviewedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "protocol",
                    "professions",
                    "status",
                    "screening",
                    "verdict",
                    "professionalId",
                    "review",
                    "priceCents",
                    "currency",
                    "createdAt",
                    "claimedAt",
                    "reviewedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/client/orders/plan": {
      "post": {
        "operationId": "client.orders.place.plan",
        "tags": [
          "client"
        ],
        "summary": "A plan for the period ahead from a professional who has read the client's SMART goals, health context and recent logs: a FITT-VP training plan from a personal trainer, an eating plan from a nutrition coach.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "professions": {
                    "minItems": 1,
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": "Keys into the professions, one or more; one professional who holds them all answers."
                  },
                  "requestedProfessionalId": {
                    "description": "A professional the client wants again; the order is theirs alone for a day.",
                    "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)$"
                  },
                  "brief": {
                    "type": "object",
                    "properties": {
                      "period": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "health": {
                        "type": "object",
                        "properties": {
                          "parq": {
                            "type": "object",
                            "properties": {
                              "heartOrBloodPressure": {
                                "type": "boolean",
                                "description": "1. Has your doctor ever said that you have a heart condition OR high blood pressure?"
                              },
                              "chestPain": {
                                "type": "boolean",
                                "description": "2. Do you feel pain in your chest at rest, during your daily activities of living, OR when you do physical activity?"
                              },
                              "dizzinessOrFainting": {
                                "type": "boolean",
                                "description": "3. Do you lose balance because of dizziness OR have you lost consciousness in the last 12 months?"
                              },
                              "otherChronicCondition": {
                                "type": "boolean",
                                "description": "4. Have you ever been diagnosed with another chronic medical condition (other than heart disease or high blood pressure)?"
                              },
                              "prescribedMedication": {
                                "type": "boolean",
                                "description": "5. Are you currently taking prescribed medications for a chronic medical condition?"
                              },
                              "boneJointSoftTissue": {
                                "type": "boolean",
                                "description": "6. Do you currently have (or have had within the past 12 months) a bone, joint, or soft tissue (muscle, ligament, or tendon) problem that could be made worse by becoming more physically active?"
                              },
                              "supervisedOnly": {
                                "type": "boolean",
                                "description": "7. Has your doctor ever said that you should only do medically supervised physical activity?"
                              },
                              "pregnant": {
                                "type": "boolean",
                                "description": "8. Are you pregnant?"
                              },
                              "eatingDisorder": {
                                "type": "boolean",
                                "description": "9. Do you have, or have you had, an eating disorder? A yes puts the service outside what we may offer."
                              },
                              "clinicianCleared": {
                                "description": "Only when any answer above is YES: has a doctor or another clinician said that you may be physically active? Leave out when every answer is no.",
                                "type": "boolean"
                              },
                              "declaredOn": {
                                "type": "string",
                                "format": "date",
                                "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])))$",
                                "description": "The date the client answered these questions themselves. The declaration is the client's own, never inferred."
                              }
                            },
                            "required": [
                              "heartOrBloodPressure",
                              "chestPain",
                              "dizzinessOrFainting",
                              "otherChronicCondition",
                              "prescribedMedication",
                              "boneJointSoftTissue",
                              "supervisedOnly",
                              "pregnant",
                              "eatingDisorder",
                              "declaredOn"
                            ],
                            "description": "The health declaration: nine questions, the clearance, and the date the client answered."
                          },
                          "diagnoses": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 80,
                                  "description": "As the clinician named it, in the client's words: type 2 diabetes, asthma, high blood pressure."
                                },
                                "since": {
                                  "type": "string",
                                  "format": "date",
                                  "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])))$"
                                },
                                "underCare": {
                                  "type": "boolean",
                                  "description": "Under a clinician's care now."
                                }
                              },
                              "required": [
                                "name",
                                "underCare"
                              ]
                            },
                            "description": "The chronic conditions a clinician has diagnosed, named, behind a yes on question 4."
                          },
                          "medications": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 80
                            },
                            "description": "Prescribed medications by name, behind a yes on question 5."
                          },
                          "conditions": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "area": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 40,
                                  "description": "Where: wrist, lower back, knee, or general."
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 3,
                                  "maxLength": 300,
                                  "description": "What it is like, in the client's words."
                                },
                                "since": {
                                  "type": "string",
                                  "format": "date",
                                  "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])))$"
                                },
                                "severity": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 5,
                                  "description": "1 (notices it) to 5 (stops the activity)."
                                },
                                "clinicianCleared": {
                                  "type": "boolean",
                                  "description": "A clinician has seen it and said training around it is fine."
                                }
                              },
                              "required": [
                                "area",
                                "description",
                                "severity",
                                "clinicianCleared"
                              ]
                            },
                            "description": "Injuries, aches and problems with bones, joints or muscles the professional plans around, one entry each, behind a yes on question 6 or on their own."
                          }
                        },
                        "required": [
                          "parq",
                          "diagnoses",
                          "medications",
                          "conditions"
                        ]
                      },
                      "body": {
                        "type": "object",
                        "properties": {
                          "sex": {
                            "type": "string",
                            "enum": [
                              "female",
                              "male",
                              "other"
                            ],
                            "description": "For the norm tables: female, male, or other when neither table fits."
                          },
                          "heightCm": {
                            "type": "number",
                            "minimum": 100,
                            "maximum": 250,
                            "description": "Centimetres."
                          },
                          "weightKg": {
                            "type": "number",
                            "minimum": 30,
                            "maximum": 300,
                            "description": "Kilograms."
                          },
                          "waistCm": {
                            "description": "Centimetres, at the navel.",
                            "type": "number",
                            "minimum": 40,
                            "maximum": 200
                          },
                          "date": {
                            "description": "When the weight and waist were taken.",
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          }
                        },
                        "required": [
                          "sex",
                          "heightCm",
                          "weightKg"
                        ]
                      },
                      "fitness": {
                        "type": "object",
                        "properties": {
                          "experience": {
                            "type": "string",
                            "enum": [
                              "beginner",
                              "intermediate",
                              "advanced",
                              "elite"
                            ],
                            "description": "NSCA training status: beginner (under two months), intermediate, advanced (a year or more), elite (competing)."
                          },
                          "activity": {
                            "type": "object",
                            "properties": {
                              "daysPerWeek": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 7
                              },
                              "minutesPerSession": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 600
                              },
                              "since": {
                                "description": "ISO date this pattern has held since; omitted when it is new.",
                                "type": "string",
                                "format": "date",
                                "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])))$"
                              }
                            },
                            "required": [
                              "daysPerWeek",
                              "minutesPerSession"
                            ],
                            "description": "What the client does now, against ACSM's regular exerciser: 30 minutes or more of moderate activity, three or more days a week, for three months or more."
                          },
                          "strength": {
                            "description": "What the client knows about their strength. Only what they know; nothing is tested for this.",
                            "type": "object",
                            "properties": {
                              "squatKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 500
                              },
                              "benchKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 400
                              },
                              "deadliftKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 500
                              },
                              "pushUps": {
                                "description": "Most in one set.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 200
                              },
                              "pullUps": {
                                "description": "Most in one set.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 100
                              }
                            }
                          },
                          "endurance": {
                            "type": "object",
                            "properties": {
                              "fiveKmMinutes": {
                                "description": "Recent 5 km time in minutes, decimals allowed: 22.5 is 22:30.",
                                "type": "number",
                                "minimum": 10,
                                "maximum": 120
                              },
                              "restingHeartRate": {
                                "description": "Beats per minute, at rest in the morning.",
                                "type": "integer",
                                "minimum": 30,
                                "maximum": 120
                              },
                              "notes": {
                                "description": "In the client's words: walks 5 km without stopping, cycles to work.",
                                "type": "string",
                                "maxLength": 300
                              }
                            }
                          },
                          "mobility": {
                            "description": "In the client's words: cannot squat below parallel, tight hips.",
                            "type": "string",
                            "maxLength": 300
                          },
                          "equipment": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "description": "dumbbells to 20 kg, gym, none, bike."
                          },
                          "daysAvailable": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 7,
                            "description": "Days a week the plan may use."
                          },
                          "minutesAvailable": {
                            "type": "integer",
                            "minimum": 10,
                            "maximum": 300,
                            "description": "Minutes per session the plan may use."
                          }
                        },
                        "required": [
                          "experience",
                          "activity",
                          "equipment",
                          "daysAvailable",
                          "minutesAvailable"
                        ]
                      },
                      "diet": {
                        "type": "object",
                        "properties": {
                          "pattern": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 60,
                            "description": "omnivore, pescatarian, vegetarian, vegan, or the client's own word: halal, kosher, low FODMAP by choice."
                          },
                          "allergies": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "food": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 60
                                },
                                "clinicianDiagnosed": {
                                  "type": "boolean",
                                  "description": "A clinician has diagnosed it, as against the client's own observation."
                                }
                              },
                              "required": [
                                "food",
                                "clinicianDiagnosed"
                              ]
                            },
                            "description": "Foods that cause a reaction. Avoided in every plan."
                          },
                          "intolerances": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "description": "Foods the client does not tolerate, in their own experience: stone fruit, lactose."
                          },
                          "dislikes": {
                            "maxItems": 30,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            }
                          },
                          "mealsPerDay": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 8,
                            "description": "Meals on an ordinary day, snacks not counted."
                          },
                          "cookingMinutes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 240,
                            "description": "Minutes the client will cook on an ordinary day."
                          },
                          "cookingSkill": {
                            "type": "string",
                            "enum": [
                              "none",
                              "basic",
                              "confident"
                            ]
                          },
                          "caffeine": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 20,
                            "description": "Cups of coffee, or the equivalent in tea or energy drinks, per day."
                          },
                          "alcohol": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100,
                            "description": "Standard drinks per week: one glass of wine, one bottle of beer, one shot each count as one."
                          },
                          "notes": {
                            "description": "Budget, family meals, shift work, in the client's words.",
                            "type": "string",
                            "maxLength": 500
                          }
                        },
                        "required": [
                          "pattern",
                          "allergies",
                          "intolerances",
                          "dislikes",
                          "mealsPerDay",
                          "cookingMinutes",
                          "cookingSkill",
                          "caffeine",
                          "alcohol"
                        ]
                      },
                      "labs": {
                        "maxItems": 40,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "marker": {
                              "type": "string",
                              "enum": [
                                "total-cholesterol",
                                "ldl",
                                "hdl",
                                "triglycerides",
                                "hba1c",
                                "fasting-glucose",
                                "ferritin",
                                "vitamin-d",
                                "blood-pressure",
                                "resting-heart-rate",
                                "other"
                              ]
                            },
                            "name": {
                              "description": "Named when the marker is other.",
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "value": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 20,
                              "description": "As on the lab report: 4.8, or 130/85 for blood pressure."
                            },
                            "unit": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 20,
                              "description": "As on the lab report: mmol/L, mg/dL, mmHg, bpm. Ask when the client gives a number without one; a value without its unit means nothing."
                            },
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "clinicianReviewed": {
                              "type": "boolean",
                              "description": "A clinician took it or has seen it."
                            }
                          },
                          "required": [
                            "marker",
                            "value",
                            "unit",
                            "date",
                            "clinicianReviewed"
                          ]
                        }
                      },
                      "goals": {
                        "minItems": 1,
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string",
                              "minLength": 3,
                              "maxLength": 300,
                              "description": "Specific: what, in the client's words."
                            },
                            "measure": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 100,
                              "description": "Measurable: what is measured. 5 km time, deadlift 1RM, waist, energy on a 1 to 5 scale."
                            },
                            "target": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100,
                              "description": "The target value with its unit: under 30 min, 100 kg, 4 or better most days."
                            },
                            "by": {
                              "type": "string",
                              "format": "date",
                              "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])))$",
                              "description": "Time bound: the date."
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "performance",
                                "wellbeing",
                                "condition"
                              ],
                              "description": "performance (stronger, faster, further), wellbeing (energy, sleep, weight for its own sake), condition (aimed at a disease or an injury; a clinician's, refused here)."
                            }
                          },
                          "required": [
                            "text",
                            "measure",
                            "target",
                            "by",
                            "kind"
                          ]
                        }
                      },
                      "sessions": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "type": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 40,
                              "description": "strength, run, walk, cycle, swim, mobility, or the client's own word."
                            },
                            "minutes": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 600
                            },
                            "rpe": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 10,
                              "description": "Borg CR10, 0 (rest) to 10 (maximal), for the whole session, asked about 30 minutes after it."
                            },
                            "exercises": {
                              "maxItems": 30,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "exercise": {
                                    "type": "string",
                                    "minLength": 2,
                                    "maxLength": 80
                                  },
                                  "sets": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 20
                                  },
                                  "reps": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                  },
                                  "load": {
                                    "description": "In kg, or as the client wrote it: bodyweight, 70%, RPE 8.",
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 30
                                  }
                                },
                                "required": [
                                  "exercise",
                                  "sets",
                                  "reps"
                                ]
                              }
                            },
                            "notes": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "required": [
                            "date",
                            "type",
                            "minutes",
                            "rpe"
                          ]
                        }
                      },
                      "wellbeing": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "sleep": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "Sleep quality last night, 1 (very, very good) to 7 (very, very bad)."
                            },
                            "fatigue": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "1 (very, very low) to 7 (very, very high)."
                            },
                            "stress": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "1 (very, very low) to 7 (very, very high)."
                            },
                            "soreness": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "Muscle soreness, 1 (very, very low) to 7 (very, very high)."
                            }
                          },
                          "required": [
                            "date",
                            "sleep",
                            "fatigue",
                            "stress",
                            "soreness"
                          ]
                        }
                      },
                      "food": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "meals": {
                              "maxItems": 12,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "time": {
                                    "type": "string",
                                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "24 hour clock: 07:30."
                                  },
                                  "items": {
                                    "minItems": 1,
                                    "maxItems": 20,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 2,
                                      "maxLength": 200
                                    },
                                    "description": "In household measures: 2 eggs, 2 slices rye bread, butter, coffee with milk."
                                  },
                                  "context": {
                                    "description": "Before or after training, at a restaurant, in the client's words.",
                                    "type": "string",
                                    "maxLength": 200
                                  }
                                },
                                "required": [
                                  "time",
                                  "items"
                                ]
                              }
                            },
                            "notes": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "required": [
                            "date",
                            "meals"
                          ]
                        }
                      },
                      "notes": {
                        "type": "string",
                        "maxLength": 2000
                      }
                    },
                    "required": [
                      "period",
                      "health",
                      "body",
                      "goals"
                    ]
                  }
                },
                "required": [
                  "professions",
                  "brief"
                ]
              },
              "example": {
                "professions": [
                  "personal-trainer"
                ],
                "brief": {
                  "period": {
                    "from": "2026-10-01",
                    "to": "2026-10-07"
                  },
                  "health": {
                    "parq": {
                      "heartOrBloodPressure": false,
                      "chestPain": false,
                      "dizzinessOrFainting": false,
                      "otherChronicCondition": false,
                      "prescribedMedication": false,
                      "boneJointSoftTissue": false,
                      "supervisedOnly": false,
                      "pregnant": false,
                      "eatingDisorder": false,
                      "declaredOn": "2026-09-20"
                    },
                    "diagnoses": [],
                    "medications": [],
                    "conditions": []
                  },
                  "body": {
                    "sex": "female",
                    "heightCm": 168,
                    "weightKg": 64
                  },
                  "fitness": {
                    "experience": "intermediate",
                    "activity": {
                      "daysPerWeek": 3,
                      "minutesPerSession": 45
                    },
                    "equipment": [
                      "dumbbells to 20 kg"
                    ],
                    "daysAvailable": 3,
                    "minutesAvailable": 60
                  },
                  "diet": {
                    "pattern": "omnivore",
                    "allergies": [],
                    "intolerances": [
                      "stone fruit"
                    ],
                    "dislikes": [],
                    "mealsPerDay": 3,
                    "cookingMinutes": 30,
                    "cookingSkill": "basic",
                    "caffeine": 2,
                    "alcohol": 1
                  },
                  "goals": [
                    {
                      "text": "Run 10 km",
                      "measure": "distance in one run",
                      "target": "10 km",
                      "by": "2026-12-31",
                      "kind": "performance"
                    }
                  ],
                  "notes": "Three days a week, dumbbells at home."
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string"
                    },
                    "professions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "assigned",
                        "reviewed",
                        "refused"
                      ]
                    },
                    "screening": {
                      "type": "object",
                      "properties": {
                        "tier": {
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 1
                            },
                            {
                              "type": "number",
                              "const": 2
                            },
                            {
                              "type": "number",
                              "const": 3
                            }
                          ]
                        },
                        "flags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "tier",
                        "flags"
                      ],
                      "additionalProperties": false
                    },
                    "verdict": {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "refused",
                            "clearance"
                          ]
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "ok"
                      ],
                      "additionalProperties": false
                    },
                    "professionalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "review": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "markdown": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "markdown"
                            ],
                            "additionalProperties": false
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "priceCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reviewedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "protocol",
                    "professions",
                    "status",
                    "screening",
                    "verdict",
                    "professionalId",
                    "review",
                    "priceCents",
                    "currency",
                    "createdAt",
                    "claimedAt",
                    "reviewedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/client/orders/evaluate": {
      "post": {
        "operationId": "client.orders.place.evaluate",
        "tags": [
          "client"
        ],
        "summary": "A professional's reading of the period that passed: the session-RPE log, the Hooper index and the food record against the SMART goals and the plan; adherence, load, wellbeing, each goal's status, what went well, what to change, what comes next.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "professions": {
                    "minItems": 1,
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": "Keys into the professions, one or more; one professional who holds them all answers."
                  },
                  "requestedProfessionalId": {
                    "description": "A professional the client wants again; the order is theirs alone for a day.",
                    "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)$"
                  },
                  "brief": {
                    "type": "object",
                    "properties": {
                      "period": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "health": {
                        "type": "object",
                        "properties": {
                          "parq": {
                            "type": "object",
                            "properties": {
                              "heartOrBloodPressure": {
                                "type": "boolean",
                                "description": "1. Has your doctor ever said that you have a heart condition OR high blood pressure?"
                              },
                              "chestPain": {
                                "type": "boolean",
                                "description": "2. Do you feel pain in your chest at rest, during your daily activities of living, OR when you do physical activity?"
                              },
                              "dizzinessOrFainting": {
                                "type": "boolean",
                                "description": "3. Do you lose balance because of dizziness OR have you lost consciousness in the last 12 months?"
                              },
                              "otherChronicCondition": {
                                "type": "boolean",
                                "description": "4. Have you ever been diagnosed with another chronic medical condition (other than heart disease or high blood pressure)?"
                              },
                              "prescribedMedication": {
                                "type": "boolean",
                                "description": "5. Are you currently taking prescribed medications for a chronic medical condition?"
                              },
                              "boneJointSoftTissue": {
                                "type": "boolean",
                                "description": "6. Do you currently have (or have had within the past 12 months) a bone, joint, or soft tissue (muscle, ligament, or tendon) problem that could be made worse by becoming more physically active?"
                              },
                              "supervisedOnly": {
                                "type": "boolean",
                                "description": "7. Has your doctor ever said that you should only do medically supervised physical activity?"
                              },
                              "pregnant": {
                                "type": "boolean",
                                "description": "8. Are you pregnant?"
                              },
                              "eatingDisorder": {
                                "type": "boolean",
                                "description": "9. Do you have, or have you had, an eating disorder? A yes puts the service outside what we may offer."
                              },
                              "clinicianCleared": {
                                "description": "Only when any answer above is YES: has a doctor or another clinician said that you may be physically active? Leave out when every answer is no.",
                                "type": "boolean"
                              },
                              "declaredOn": {
                                "type": "string",
                                "format": "date",
                                "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])))$",
                                "description": "The date the client answered these questions themselves. The declaration is the client's own, never inferred."
                              }
                            },
                            "required": [
                              "heartOrBloodPressure",
                              "chestPain",
                              "dizzinessOrFainting",
                              "otherChronicCondition",
                              "prescribedMedication",
                              "boneJointSoftTissue",
                              "supervisedOnly",
                              "pregnant",
                              "eatingDisorder",
                              "declaredOn"
                            ],
                            "description": "The health declaration: nine questions, the clearance, and the date the client answered."
                          },
                          "diagnoses": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 80,
                                  "description": "As the clinician named it, in the client's words: type 2 diabetes, asthma, high blood pressure."
                                },
                                "since": {
                                  "type": "string",
                                  "format": "date",
                                  "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])))$"
                                },
                                "underCare": {
                                  "type": "boolean",
                                  "description": "Under a clinician's care now."
                                }
                              },
                              "required": [
                                "name",
                                "underCare"
                              ]
                            },
                            "description": "The chronic conditions a clinician has diagnosed, named, behind a yes on question 4."
                          },
                          "medications": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 80
                            },
                            "description": "Prescribed medications by name, behind a yes on question 5."
                          },
                          "conditions": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "area": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 40,
                                  "description": "Where: wrist, lower back, knee, or general."
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 3,
                                  "maxLength": 300,
                                  "description": "What it is like, in the client's words."
                                },
                                "since": {
                                  "type": "string",
                                  "format": "date",
                                  "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])))$"
                                },
                                "severity": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 5,
                                  "description": "1 (notices it) to 5 (stops the activity)."
                                },
                                "clinicianCleared": {
                                  "type": "boolean",
                                  "description": "A clinician has seen it and said training around it is fine."
                                }
                              },
                              "required": [
                                "area",
                                "description",
                                "severity",
                                "clinicianCleared"
                              ]
                            },
                            "description": "Injuries, aches and problems with bones, joints or muscles the professional plans around, one entry each, behind a yes on question 6 or on their own."
                          }
                        },
                        "required": [
                          "parq",
                          "diagnoses",
                          "medications",
                          "conditions"
                        ]
                      },
                      "body": {
                        "type": "object",
                        "properties": {
                          "sex": {
                            "type": "string",
                            "enum": [
                              "female",
                              "male",
                              "other"
                            ],
                            "description": "For the norm tables: female, male, or other when neither table fits."
                          },
                          "heightCm": {
                            "type": "number",
                            "minimum": 100,
                            "maximum": 250,
                            "description": "Centimetres."
                          },
                          "weightKg": {
                            "type": "number",
                            "minimum": 30,
                            "maximum": 300,
                            "description": "Kilograms."
                          },
                          "waistCm": {
                            "description": "Centimetres, at the navel.",
                            "type": "number",
                            "minimum": 40,
                            "maximum": 200
                          },
                          "date": {
                            "description": "When the weight and waist were taken.",
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          }
                        },
                        "required": [
                          "sex",
                          "heightCm",
                          "weightKg"
                        ]
                      },
                      "fitness": {
                        "type": "object",
                        "properties": {
                          "experience": {
                            "type": "string",
                            "enum": [
                              "beginner",
                              "intermediate",
                              "advanced",
                              "elite"
                            ],
                            "description": "NSCA training status: beginner (under two months), intermediate, advanced (a year or more), elite (competing)."
                          },
                          "activity": {
                            "type": "object",
                            "properties": {
                              "daysPerWeek": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 7
                              },
                              "minutesPerSession": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 600
                              },
                              "since": {
                                "description": "ISO date this pattern has held since; omitted when it is new.",
                                "type": "string",
                                "format": "date",
                                "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])))$"
                              }
                            },
                            "required": [
                              "daysPerWeek",
                              "minutesPerSession"
                            ],
                            "description": "What the client does now, against ACSM's regular exerciser: 30 minutes or more of moderate activity, three or more days a week, for three months or more."
                          },
                          "strength": {
                            "description": "What the client knows about their strength. Only what they know; nothing is tested for this.",
                            "type": "object",
                            "properties": {
                              "squatKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 500
                              },
                              "benchKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 400
                              },
                              "deadliftKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 500
                              },
                              "pushUps": {
                                "description": "Most in one set.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 200
                              },
                              "pullUps": {
                                "description": "Most in one set.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 100
                              }
                            }
                          },
                          "endurance": {
                            "type": "object",
                            "properties": {
                              "fiveKmMinutes": {
                                "description": "Recent 5 km time in minutes, decimals allowed: 22.5 is 22:30.",
                                "type": "number",
                                "minimum": 10,
                                "maximum": 120
                              },
                              "restingHeartRate": {
                                "description": "Beats per minute, at rest in the morning.",
                                "type": "integer",
                                "minimum": 30,
                                "maximum": 120
                              },
                              "notes": {
                                "description": "In the client's words: walks 5 km without stopping, cycles to work.",
                                "type": "string",
                                "maxLength": 300
                              }
                            }
                          },
                          "mobility": {
                            "description": "In the client's words: cannot squat below parallel, tight hips.",
                            "type": "string",
                            "maxLength": 300
                          },
                          "equipment": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "description": "dumbbells to 20 kg, gym, none, bike."
                          },
                          "daysAvailable": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 7,
                            "description": "Days a week the plan may use."
                          },
                          "minutesAvailable": {
                            "type": "integer",
                            "minimum": 10,
                            "maximum": 300,
                            "description": "Minutes per session the plan may use."
                          }
                        },
                        "required": [
                          "experience",
                          "activity",
                          "equipment",
                          "daysAvailable",
                          "minutesAvailable"
                        ]
                      },
                      "diet": {
                        "type": "object",
                        "properties": {
                          "pattern": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 60,
                            "description": "omnivore, pescatarian, vegetarian, vegan, or the client's own word: halal, kosher, low FODMAP by choice."
                          },
                          "allergies": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "food": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 60
                                },
                                "clinicianDiagnosed": {
                                  "type": "boolean",
                                  "description": "A clinician has diagnosed it, as against the client's own observation."
                                }
                              },
                              "required": [
                                "food",
                                "clinicianDiagnosed"
                              ]
                            },
                            "description": "Foods that cause a reaction. Avoided in every plan."
                          },
                          "intolerances": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "description": "Foods the client does not tolerate, in their own experience: stone fruit, lactose."
                          },
                          "dislikes": {
                            "maxItems": 30,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            }
                          },
                          "mealsPerDay": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 8,
                            "description": "Meals on an ordinary day, snacks not counted."
                          },
                          "cookingMinutes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 240,
                            "description": "Minutes the client will cook on an ordinary day."
                          },
                          "cookingSkill": {
                            "type": "string",
                            "enum": [
                              "none",
                              "basic",
                              "confident"
                            ]
                          },
                          "caffeine": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 20,
                            "description": "Cups of coffee, or the equivalent in tea or energy drinks, per day."
                          },
                          "alcohol": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100,
                            "description": "Standard drinks per week: one glass of wine, one bottle of beer, one shot each count as one."
                          },
                          "notes": {
                            "description": "Budget, family meals, shift work, in the client's words.",
                            "type": "string",
                            "maxLength": 500
                          }
                        },
                        "required": [
                          "pattern",
                          "allergies",
                          "intolerances",
                          "dislikes",
                          "mealsPerDay",
                          "cookingMinutes",
                          "cookingSkill",
                          "caffeine",
                          "alcohol"
                        ]
                      },
                      "labs": {
                        "maxItems": 40,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "marker": {
                              "type": "string",
                              "enum": [
                                "total-cholesterol",
                                "ldl",
                                "hdl",
                                "triglycerides",
                                "hba1c",
                                "fasting-glucose",
                                "ferritin",
                                "vitamin-d",
                                "blood-pressure",
                                "resting-heart-rate",
                                "other"
                              ]
                            },
                            "name": {
                              "description": "Named when the marker is other.",
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "value": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 20,
                              "description": "As on the lab report: 4.8, or 130/85 for blood pressure."
                            },
                            "unit": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 20,
                              "description": "As on the lab report: mmol/L, mg/dL, mmHg, bpm. Ask when the client gives a number without one; a value without its unit means nothing."
                            },
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "clinicianReviewed": {
                              "type": "boolean",
                              "description": "A clinician took it or has seen it."
                            }
                          },
                          "required": [
                            "marker",
                            "value",
                            "unit",
                            "date",
                            "clinicianReviewed"
                          ]
                        }
                      },
                      "goals": {
                        "minItems": 1,
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string",
                              "minLength": 3,
                              "maxLength": 300,
                              "description": "Specific: what, in the client's words."
                            },
                            "measure": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 100,
                              "description": "Measurable: what is measured. 5 km time, deadlift 1RM, waist, energy on a 1 to 5 scale."
                            },
                            "target": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100,
                              "description": "The target value with its unit: under 30 min, 100 kg, 4 or better most days."
                            },
                            "by": {
                              "type": "string",
                              "format": "date",
                              "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])))$",
                              "description": "Time bound: the date."
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "performance",
                                "wellbeing",
                                "condition"
                              ],
                              "description": "performance (stronger, faster, further), wellbeing (energy, sleep, weight for its own sake), condition (aimed at a disease or an injury; a clinician's, refused here)."
                            }
                          },
                          "required": [
                            "text",
                            "measure",
                            "target",
                            "by",
                            "kind"
                          ]
                        }
                      },
                      "sessions": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "type": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 40,
                              "description": "strength, run, walk, cycle, swim, mobility, or the client's own word."
                            },
                            "minutes": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 600
                            },
                            "rpe": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 10,
                              "description": "Borg CR10, 0 (rest) to 10 (maximal), for the whole session, asked about 30 minutes after it."
                            },
                            "exercises": {
                              "maxItems": 30,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "exercise": {
                                    "type": "string",
                                    "minLength": 2,
                                    "maxLength": 80
                                  },
                                  "sets": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 20
                                  },
                                  "reps": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                  },
                                  "load": {
                                    "description": "In kg, or as the client wrote it: bodyweight, 70%, RPE 8.",
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 30
                                  }
                                },
                                "required": [
                                  "exercise",
                                  "sets",
                                  "reps"
                                ]
                              }
                            },
                            "notes": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "required": [
                            "date",
                            "type",
                            "minutes",
                            "rpe"
                          ]
                        }
                      },
                      "wellbeing": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "sleep": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "Sleep quality last night, 1 (very, very good) to 7 (very, very bad)."
                            },
                            "fatigue": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "1 (very, very low) to 7 (very, very high)."
                            },
                            "stress": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "1 (very, very low) to 7 (very, very high)."
                            },
                            "soreness": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "Muscle soreness, 1 (very, very low) to 7 (very, very high)."
                            }
                          },
                          "required": [
                            "date",
                            "sleep",
                            "fatigue",
                            "stress",
                            "soreness"
                          ]
                        }
                      },
                      "food": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "meals": {
                              "maxItems": 12,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "time": {
                                    "type": "string",
                                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "24 hour clock: 07:30."
                                  },
                                  "items": {
                                    "minItems": 1,
                                    "maxItems": 20,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 2,
                                      "maxLength": 200
                                    },
                                    "description": "In household measures: 2 eggs, 2 slices rye bread, butter, coffee with milk."
                                  },
                                  "context": {
                                    "description": "Before or after training, at a restaurant, in the client's words.",
                                    "type": "string",
                                    "maxLength": 200
                                  }
                                },
                                "required": [
                                  "time",
                                  "items"
                                ]
                              }
                            },
                            "notes": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "required": [
                            "date",
                            "meals"
                          ]
                        }
                      },
                      "plan": {},
                      "notes": {
                        "type": "string",
                        "maxLength": 2000
                      }
                    },
                    "required": [
                      "period",
                      "health",
                      "body",
                      "goals"
                    ]
                  }
                },
                "required": [
                  "professions",
                  "brief"
                ]
              },
              "example": {
                "professions": [
                  "personal-trainer"
                ],
                "brief": {
                  "period": {
                    "from": "2026-10-01",
                    "to": "2026-10-07"
                  },
                  "health": {
                    "parq": {
                      "heartOrBloodPressure": false,
                      "chestPain": false,
                      "dizzinessOrFainting": false,
                      "otherChronicCondition": false,
                      "prescribedMedication": false,
                      "boneJointSoftTissue": false,
                      "supervisedOnly": false,
                      "pregnant": false,
                      "eatingDisorder": false,
                      "declaredOn": "2026-09-20"
                    },
                    "diagnoses": [],
                    "medications": [],
                    "conditions": []
                  },
                  "body": {
                    "sex": "female",
                    "heightCm": 168,
                    "weightKg": 64
                  },
                  "fitness": {
                    "experience": "intermediate",
                    "activity": {
                      "daysPerWeek": 3,
                      "minutesPerSession": 45
                    },
                    "equipment": [
                      "dumbbells to 20 kg"
                    ],
                    "daysAvailable": 3,
                    "minutesAvailable": 60
                  },
                  "diet": {
                    "pattern": "omnivore",
                    "allergies": [],
                    "intolerances": [
                      "stone fruit"
                    ],
                    "dislikes": [],
                    "mealsPerDay": 3,
                    "cookingMinutes": 30,
                    "cookingSkill": "basic",
                    "caffeine": 2,
                    "alcohol": 1
                  },
                  "goals": [
                    {
                      "text": "Run 10 km",
                      "measure": "distance in one run",
                      "target": "10 km",
                      "by": "2026-12-31",
                      "kind": "performance"
                    }
                  ],
                  "notes": "Three days a week, dumbbells at home.",
                  "plan": {
                    "personal-trainer": {
                      "markdown": "# Summary\nThree runs and two dumbbell sessions a week; the wrist stays neutral under load. \n\n# Weeks\n## Week 1\n### Day 1: run\nRPE 3, 30 minutes, easy.\n\n### Day 3: strength\nRPE 7, 45 minutes. Dumbbell row 3 x 10 at 14 kg, rest 90 s. Goblet squat 3 x 10.\n\n# Progression\nAdd five minutes to each run while RPE stays at 3; add one set to the rows in week three.\n\n# Adaptations\nNeutral grip on every press; no push-ups on the palm until the wrist settles.\n\n# Referral\nNone."
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string"
                    },
                    "professions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "assigned",
                        "reviewed",
                        "refused"
                      ]
                    },
                    "screening": {
                      "type": "object",
                      "properties": {
                        "tier": {
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 1
                            },
                            {
                              "type": "number",
                              "const": 2
                            },
                            {
                              "type": "number",
                              "const": 3
                            }
                          ]
                        },
                        "flags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "tier",
                        "flags"
                      ],
                      "additionalProperties": false
                    },
                    "verdict": {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "refused",
                            "clearance"
                          ]
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "ok"
                      ],
                      "additionalProperties": false
                    },
                    "professionalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "review": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "markdown": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "markdown"
                            ],
                            "additionalProperties": false
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "priceCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reviewedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "protocol",
                    "professions",
                    "status",
                    "screening",
                    "verdict",
                    "professionalId",
                    "review",
                    "priceCents",
                    "currency",
                    "createdAt",
                    "claimedAt",
                    "reviewedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/client/orders/review-plan": {
      "post": {
        "operationId": "client.orders.place.review-plan",
        "tags": [
          "client"
        ],
        "summary": "A professional's review of a plan the client's agent wrote, in the profession's own plan standard: a verdict, findings with what to change, and what the plan must avoid.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "professions": {
                    "minItems": 1,
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": "Keys into the professions, one or more; one professional who holds them all answers."
                  },
                  "requestedProfessionalId": {
                    "description": "A professional the client wants again; the order is theirs alone for a day.",
                    "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)$"
                  },
                  "brief": {
                    "type": "object",
                    "properties": {
                      "period": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "health": {
                        "type": "object",
                        "properties": {
                          "parq": {
                            "type": "object",
                            "properties": {
                              "heartOrBloodPressure": {
                                "type": "boolean",
                                "description": "1. Has your doctor ever said that you have a heart condition OR high blood pressure?"
                              },
                              "chestPain": {
                                "type": "boolean",
                                "description": "2. Do you feel pain in your chest at rest, during your daily activities of living, OR when you do physical activity?"
                              },
                              "dizzinessOrFainting": {
                                "type": "boolean",
                                "description": "3. Do you lose balance because of dizziness OR have you lost consciousness in the last 12 months?"
                              },
                              "otherChronicCondition": {
                                "type": "boolean",
                                "description": "4. Have you ever been diagnosed with another chronic medical condition (other than heart disease or high blood pressure)?"
                              },
                              "prescribedMedication": {
                                "type": "boolean",
                                "description": "5. Are you currently taking prescribed medications for a chronic medical condition?"
                              },
                              "boneJointSoftTissue": {
                                "type": "boolean",
                                "description": "6. Do you currently have (or have had within the past 12 months) a bone, joint, or soft tissue (muscle, ligament, or tendon) problem that could be made worse by becoming more physically active?"
                              },
                              "supervisedOnly": {
                                "type": "boolean",
                                "description": "7. Has your doctor ever said that you should only do medically supervised physical activity?"
                              },
                              "pregnant": {
                                "type": "boolean",
                                "description": "8. Are you pregnant?"
                              },
                              "eatingDisorder": {
                                "type": "boolean",
                                "description": "9. Do you have, or have you had, an eating disorder? A yes puts the service outside what we may offer."
                              },
                              "clinicianCleared": {
                                "description": "Only when any answer above is YES: has a doctor or another clinician said that you may be physically active? Leave out when every answer is no.",
                                "type": "boolean"
                              },
                              "declaredOn": {
                                "type": "string",
                                "format": "date",
                                "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])))$",
                                "description": "The date the client answered these questions themselves. The declaration is the client's own, never inferred."
                              }
                            },
                            "required": [
                              "heartOrBloodPressure",
                              "chestPain",
                              "dizzinessOrFainting",
                              "otherChronicCondition",
                              "prescribedMedication",
                              "boneJointSoftTissue",
                              "supervisedOnly",
                              "pregnant",
                              "eatingDisorder",
                              "declaredOn"
                            ],
                            "description": "The health declaration: nine questions, the clearance, and the date the client answered."
                          },
                          "diagnoses": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 80,
                                  "description": "As the clinician named it, in the client's words: type 2 diabetes, asthma, high blood pressure."
                                },
                                "since": {
                                  "type": "string",
                                  "format": "date",
                                  "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])))$"
                                },
                                "underCare": {
                                  "type": "boolean",
                                  "description": "Under a clinician's care now."
                                }
                              },
                              "required": [
                                "name",
                                "underCare"
                              ]
                            },
                            "description": "The chronic conditions a clinician has diagnosed, named, behind a yes on question 4."
                          },
                          "medications": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 80
                            },
                            "description": "Prescribed medications by name, behind a yes on question 5."
                          },
                          "conditions": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "area": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 40,
                                  "description": "Where: wrist, lower back, knee, or general."
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 3,
                                  "maxLength": 300,
                                  "description": "What it is like, in the client's words."
                                },
                                "since": {
                                  "type": "string",
                                  "format": "date",
                                  "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])))$"
                                },
                                "severity": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 5,
                                  "description": "1 (notices it) to 5 (stops the activity)."
                                },
                                "clinicianCleared": {
                                  "type": "boolean",
                                  "description": "A clinician has seen it and said training around it is fine."
                                }
                              },
                              "required": [
                                "area",
                                "description",
                                "severity",
                                "clinicianCleared"
                              ]
                            },
                            "description": "Injuries, aches and problems with bones, joints or muscles the professional plans around, one entry each, behind a yes on question 6 or on their own."
                          }
                        },
                        "required": [
                          "parq",
                          "diagnoses",
                          "medications",
                          "conditions"
                        ]
                      },
                      "body": {
                        "type": "object",
                        "properties": {
                          "sex": {
                            "type": "string",
                            "enum": [
                              "female",
                              "male",
                              "other"
                            ],
                            "description": "For the norm tables: female, male, or other when neither table fits."
                          },
                          "heightCm": {
                            "type": "number",
                            "minimum": 100,
                            "maximum": 250,
                            "description": "Centimetres."
                          },
                          "weightKg": {
                            "type": "number",
                            "minimum": 30,
                            "maximum": 300,
                            "description": "Kilograms."
                          },
                          "waistCm": {
                            "description": "Centimetres, at the navel.",
                            "type": "number",
                            "minimum": 40,
                            "maximum": 200
                          },
                          "date": {
                            "description": "When the weight and waist were taken.",
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          }
                        },
                        "required": [
                          "sex",
                          "heightCm",
                          "weightKg"
                        ]
                      },
                      "fitness": {
                        "type": "object",
                        "properties": {
                          "experience": {
                            "type": "string",
                            "enum": [
                              "beginner",
                              "intermediate",
                              "advanced",
                              "elite"
                            ],
                            "description": "NSCA training status: beginner (under two months), intermediate, advanced (a year or more), elite (competing)."
                          },
                          "activity": {
                            "type": "object",
                            "properties": {
                              "daysPerWeek": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 7
                              },
                              "minutesPerSession": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 600
                              },
                              "since": {
                                "description": "ISO date this pattern has held since; omitted when it is new.",
                                "type": "string",
                                "format": "date",
                                "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])))$"
                              }
                            },
                            "required": [
                              "daysPerWeek",
                              "minutesPerSession"
                            ],
                            "description": "What the client does now, against ACSM's regular exerciser: 30 minutes or more of moderate activity, three or more days a week, for three months or more."
                          },
                          "strength": {
                            "description": "What the client knows about their strength. Only what they know; nothing is tested for this.",
                            "type": "object",
                            "properties": {
                              "squatKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 500
                              },
                              "benchKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 400
                              },
                              "deadliftKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 500
                              },
                              "pushUps": {
                                "description": "Most in one set.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 200
                              },
                              "pullUps": {
                                "description": "Most in one set.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 100
                              }
                            }
                          },
                          "endurance": {
                            "type": "object",
                            "properties": {
                              "fiveKmMinutes": {
                                "description": "Recent 5 km time in minutes, decimals allowed: 22.5 is 22:30.",
                                "type": "number",
                                "minimum": 10,
                                "maximum": 120
                              },
                              "restingHeartRate": {
                                "description": "Beats per minute, at rest in the morning.",
                                "type": "integer",
                                "minimum": 30,
                                "maximum": 120
                              },
                              "notes": {
                                "description": "In the client's words: walks 5 km without stopping, cycles to work.",
                                "type": "string",
                                "maxLength": 300
                              }
                            }
                          },
                          "mobility": {
                            "description": "In the client's words: cannot squat below parallel, tight hips.",
                            "type": "string",
                            "maxLength": 300
                          },
                          "equipment": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "description": "dumbbells to 20 kg, gym, none, bike."
                          },
                          "daysAvailable": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 7,
                            "description": "Days a week the plan may use."
                          },
                          "minutesAvailable": {
                            "type": "integer",
                            "minimum": 10,
                            "maximum": 300,
                            "description": "Minutes per session the plan may use."
                          }
                        },
                        "required": [
                          "experience",
                          "activity",
                          "equipment",
                          "daysAvailable",
                          "minutesAvailable"
                        ]
                      },
                      "diet": {
                        "type": "object",
                        "properties": {
                          "pattern": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 60,
                            "description": "omnivore, pescatarian, vegetarian, vegan, or the client's own word: halal, kosher, low FODMAP by choice."
                          },
                          "allergies": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "food": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 60
                                },
                                "clinicianDiagnosed": {
                                  "type": "boolean",
                                  "description": "A clinician has diagnosed it, as against the client's own observation."
                                }
                              },
                              "required": [
                                "food",
                                "clinicianDiagnosed"
                              ]
                            },
                            "description": "Foods that cause a reaction. Avoided in every plan."
                          },
                          "intolerances": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "description": "Foods the client does not tolerate, in their own experience: stone fruit, lactose."
                          },
                          "dislikes": {
                            "maxItems": 30,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            }
                          },
                          "mealsPerDay": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 8,
                            "description": "Meals on an ordinary day, snacks not counted."
                          },
                          "cookingMinutes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 240,
                            "description": "Minutes the client will cook on an ordinary day."
                          },
                          "cookingSkill": {
                            "type": "string",
                            "enum": [
                              "none",
                              "basic",
                              "confident"
                            ]
                          },
                          "caffeine": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 20,
                            "description": "Cups of coffee, or the equivalent in tea or energy drinks, per day."
                          },
                          "alcohol": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100,
                            "description": "Standard drinks per week: one glass of wine, one bottle of beer, one shot each count as one."
                          },
                          "notes": {
                            "description": "Budget, family meals, shift work, in the client's words.",
                            "type": "string",
                            "maxLength": 500
                          }
                        },
                        "required": [
                          "pattern",
                          "allergies",
                          "intolerances",
                          "dislikes",
                          "mealsPerDay",
                          "cookingMinutes",
                          "cookingSkill",
                          "caffeine",
                          "alcohol"
                        ]
                      },
                      "labs": {
                        "maxItems": 40,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "marker": {
                              "type": "string",
                              "enum": [
                                "total-cholesterol",
                                "ldl",
                                "hdl",
                                "triglycerides",
                                "hba1c",
                                "fasting-glucose",
                                "ferritin",
                                "vitamin-d",
                                "blood-pressure",
                                "resting-heart-rate",
                                "other"
                              ]
                            },
                            "name": {
                              "description": "Named when the marker is other.",
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "value": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 20,
                              "description": "As on the lab report: 4.8, or 130/85 for blood pressure."
                            },
                            "unit": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 20,
                              "description": "As on the lab report: mmol/L, mg/dL, mmHg, bpm. Ask when the client gives a number without one; a value without its unit means nothing."
                            },
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "clinicianReviewed": {
                              "type": "boolean",
                              "description": "A clinician took it or has seen it."
                            }
                          },
                          "required": [
                            "marker",
                            "value",
                            "unit",
                            "date",
                            "clinicianReviewed"
                          ]
                        }
                      },
                      "goals": {
                        "minItems": 1,
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string",
                              "minLength": 3,
                              "maxLength": 300,
                              "description": "Specific: what, in the client's words."
                            },
                            "measure": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 100,
                              "description": "Measurable: what is measured. 5 km time, deadlift 1RM, waist, energy on a 1 to 5 scale."
                            },
                            "target": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100,
                              "description": "The target value with its unit: under 30 min, 100 kg, 4 or better most days."
                            },
                            "by": {
                              "type": "string",
                              "format": "date",
                              "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])))$",
                              "description": "Time bound: the date."
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "performance",
                                "wellbeing",
                                "condition"
                              ],
                              "description": "performance (stronger, faster, further), wellbeing (energy, sleep, weight for its own sake), condition (aimed at a disease or an injury; a clinician's, refused here)."
                            }
                          },
                          "required": [
                            "text",
                            "measure",
                            "target",
                            "by",
                            "kind"
                          ]
                        }
                      },
                      "sessions": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "type": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 40,
                              "description": "strength, run, walk, cycle, swim, mobility, or the client's own word."
                            },
                            "minutes": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 600
                            },
                            "rpe": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 10,
                              "description": "Borg CR10, 0 (rest) to 10 (maximal), for the whole session, asked about 30 minutes after it."
                            },
                            "exercises": {
                              "maxItems": 30,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "exercise": {
                                    "type": "string",
                                    "minLength": 2,
                                    "maxLength": 80
                                  },
                                  "sets": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 20
                                  },
                                  "reps": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                  },
                                  "load": {
                                    "description": "In kg, or as the client wrote it: bodyweight, 70%, RPE 8.",
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 30
                                  }
                                },
                                "required": [
                                  "exercise",
                                  "sets",
                                  "reps"
                                ]
                              }
                            },
                            "notes": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "required": [
                            "date",
                            "type",
                            "minutes",
                            "rpe"
                          ]
                        }
                      },
                      "wellbeing": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "sleep": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "Sleep quality last night, 1 (very, very good) to 7 (very, very bad)."
                            },
                            "fatigue": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "1 (very, very low) to 7 (very, very high)."
                            },
                            "stress": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "1 (very, very low) to 7 (very, very high)."
                            },
                            "soreness": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "Muscle soreness, 1 (very, very low) to 7 (very, very high)."
                            }
                          },
                          "required": [
                            "date",
                            "sleep",
                            "fatigue",
                            "stress",
                            "soreness"
                          ]
                        }
                      },
                      "food": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "meals": {
                              "maxItems": 12,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "time": {
                                    "type": "string",
                                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "24 hour clock: 07:30."
                                  },
                                  "items": {
                                    "minItems": 1,
                                    "maxItems": 20,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 2,
                                      "maxLength": 200
                                    },
                                    "description": "In household measures: 2 eggs, 2 slices rye bread, butter, coffee with milk."
                                  },
                                  "context": {
                                    "description": "Before or after training, at a restaurant, in the client's words.",
                                    "type": "string",
                                    "maxLength": 200
                                  }
                                },
                                "required": [
                                  "time",
                                  "items"
                                ]
                              }
                            },
                            "notes": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "required": [
                            "date",
                            "meals"
                          ]
                        }
                      },
                      "notes": {
                        "type": "string",
                        "maxLength": 2000
                      },
                      "plan": {},
                      "question": {
                        "type": "string",
                        "maxLength": 1000
                      }
                    },
                    "required": [
                      "period",
                      "health",
                      "body",
                      "goals",
                      "plan"
                    ]
                  }
                },
                "required": [
                  "professions",
                  "brief"
                ]
              },
              "example": {
                "professions": [
                  "personal-trainer"
                ],
                "brief": {
                  "period": {
                    "from": "2026-10-01",
                    "to": "2026-10-07"
                  },
                  "health": {
                    "parq": {
                      "heartOrBloodPressure": false,
                      "chestPain": false,
                      "dizzinessOrFainting": false,
                      "otherChronicCondition": false,
                      "prescribedMedication": false,
                      "boneJointSoftTissue": false,
                      "supervisedOnly": false,
                      "pregnant": false,
                      "eatingDisorder": false,
                      "declaredOn": "2026-09-20"
                    },
                    "diagnoses": [],
                    "medications": [],
                    "conditions": []
                  },
                  "body": {
                    "sex": "female",
                    "heightCm": 168,
                    "weightKg": 64
                  },
                  "fitness": {
                    "experience": "intermediate",
                    "activity": {
                      "daysPerWeek": 3,
                      "minutesPerSession": 45
                    },
                    "equipment": [
                      "dumbbells to 20 kg"
                    ],
                    "daysAvailable": 3,
                    "minutesAvailable": 60
                  },
                  "diet": {
                    "pattern": "omnivore",
                    "allergies": [],
                    "intolerances": [
                      "stone fruit"
                    ],
                    "dislikes": [],
                    "mealsPerDay": 3,
                    "cookingMinutes": 30,
                    "cookingSkill": "basic",
                    "caffeine": 2,
                    "alcohol": 1
                  },
                  "goals": [
                    {
                      "text": "Run 10 km",
                      "measure": "distance in one run",
                      "target": "10 km",
                      "by": "2026-12-31",
                      "kind": "performance"
                    }
                  ],
                  "notes": "Three days a week, dumbbells at home.",
                  "plan": {
                    "personal-trainer": {
                      "markdown": "# Summary\nThree runs and two dumbbell sessions a week; the wrist stays neutral under load. \n\n# Weeks\n## Week 1\n### Day 1: run\nRPE 3, 30 minutes, easy.\n\n### Day 3: strength\nRPE 7, 45 minutes. Dumbbell row 3 x 10 at 14 kg, rest 90 s. Goblet squat 3 x 10.\n\n# Progression\nAdd five minutes to each run while RPE stays at 3; add one set to the rows in week three.\n\n# Adaptations\nNeutral grip on every press; no push-ups on the palm until the wrist settles.\n\n# Referral\nNone."
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string"
                    },
                    "professions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "assigned",
                        "reviewed",
                        "refused"
                      ]
                    },
                    "screening": {
                      "type": "object",
                      "properties": {
                        "tier": {
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 1
                            },
                            {
                              "type": "number",
                              "const": 2
                            },
                            {
                              "type": "number",
                              "const": 3
                            }
                          ]
                        },
                        "flags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "tier",
                        "flags"
                      ],
                      "additionalProperties": false
                    },
                    "verdict": {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "refused",
                            "clearance"
                          ]
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "ok"
                      ],
                      "additionalProperties": false
                    },
                    "professionalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "review": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "markdown": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "markdown"
                            ],
                            "additionalProperties": false
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "priceCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reviewedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "protocol",
                    "professions",
                    "status",
                    "screening",
                    "verdict",
                    "professionalId",
                    "review",
                    "priceCents",
                    "currency",
                    "createdAt",
                    "claimedAt",
                    "reviewedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/client/grants": {
      "get": {
        "operationId": "client.grants.list",
        "tags": [
          "client"
        ],
        "summary": "The agents allowed to act for the client, by the name each gave when it registered.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "oauthClientId": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "grantedAt": {
                        "type": "string"
                      },
                      "tokens": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "oauthClientId",
                      "name",
                      "grantedAt",
                      "tokens"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/client/grants/{oauthClientId}": {
      "delete": {
        "operationId": "client.grants.revoke",
        "tags": [
          "client"
        ],
        "summary": "Revokes every token that agent holds. It has to be allowed again to continue.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session or OAuth access token of a client>.",
        "parameters": [
          {
            "name": "oauthClientId",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/me": {
      "get": {
        "operationId": "organisation.me",
        "tags": [
          "organisation"
        ],
        "summary": "The organisation.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    },
                    "vatNumber": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "email",
                    "country",
                    "vatNumber",
                    "currency",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "organisation.update",
        "tags": [
          "organisation"
        ],
        "summary": "Name, email, country and VAT number for the receipt. A VAT number of the organisation's own EU country, outside Sweden, makes its deposits reverse charged. The currency is fixed.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of an organisation>.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 120
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 200,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Z]{2}$"
                  },
                  "vatNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{2}[A-Z0-9]{2,12}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "example": {
                "vatNumber": "SE556894438201"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    },
                    "vatNumber": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "email",
                    "country",
                    "vatNumber",
                    "currency",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/balance": {
      "get": {
        "operationId": "organisation.balance",
        "tags": [
          "organisation"
        ],
        "summary": "The pot: credits, charged, reserved by the clients' open orders, available.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "paidBy": {
                      "type": "string",
                      "enum": [
                        "self",
                        "organisation"
                      ]
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "charged": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "reserved": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "available": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "paidBy",
                    "currency",
                    "credits",
                    "charged",
                    "reserved",
                    "available"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/statement": {
      "get": {
        "operationId": "organisation.statement",
        "tags": [
          "organisation"
        ],
        "summary": "Every deposit and every delivered order with its price and the client it was for, newest first.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "credit",
                          "charge"
                        ]
                      },
                      "amountCents": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "ref": {
                        "type": "string"
                      },
                      "clientRef": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "description": {
                        "type": "string"
                      },
                      "at": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "kind",
                      "amountCents",
                      "ref",
                      "clientRef",
                      "description",
                      "at"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/deposits": {
      "get": {
        "operationId": "organisation.deposits.list",
        "tags": [
          "organisation"
        ],
        "summary": "The deposits paid through the provider, each with its receipt: net, tax and total in the organisation's currency.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "ref": {
                        "type": "string"
                      },
                      "receiptNumber": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "currency": {
                        "type": "string",
                        "enum": [
                          "USD",
                          "EUR"
                        ]
                      },
                      "amountCents": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "taxPercent": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "taxCents": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "totalCents": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "at": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "ref",
                      "receiptNumber",
                      "currency",
                      "amountCents",
                      "taxPercent",
                      "taxCents",
                      "totalCents",
                      "at"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "organisation.deposit.start",
        "tags": [
          "organisation"
        ],
        "summary": "Starts a deposit with the payment provider and answers the page to pay on, with the tax added for the organisation's country and VAT number. The pot is credited the net amount when the provider confirms; the receipt goes by mail.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of an organisation>.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amountCents": {
                    "type": "integer",
                    "minimum": 10000,
                    "maximum": 10000000,
                    "description": "Cents in the organisation's currency, net of tax; 100 to 100 000 dollars or euro."
                  },
                  "returnUrl": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": [
                  "amountCents"
                ]
              },
              "example": {
                "amountCents": 100000
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "ref": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "amountCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "taxPercent": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "taxCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "totalCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "url",
                    "ref",
                    "currency",
                    "amountCents",
                    "taxPercent",
                    "taxCents",
                    "totalCents"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/receipts": {
      "get": {
        "operationId": "organisation.receipts",
        "tags": [
          "organisation"
        ],
        "summary": "The provider's page with the organisation's receipts, when the provider has one; null otherwise, and the receipts are in the deposits.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of an organisation>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "url"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/keys": {
      "get": {
        "operationId": "organisation.keys.list",
        "tags": [
          "organisation"
        ],
        "summary": "The API keys by prefix, never the key.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "prefix": {
                        "type": "string"
                      },
                      "createdAt": {
                        "type": "string"
                      },
                      "lastUsedAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "revokedAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "prefix",
                      "createdAt",
                      "lastUsedAt",
                      "revokedAt"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "organisation.keys.create",
        "tags": [
          "organisation"
        ],
        "summary": "A new API key, shown once. A key cannot make keys.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of an organisation>.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "production"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "prefix": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "lastUsedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "revokedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "key": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "prefix",
                    "createdAt",
                    "lastUsedAt",
                    "revokedAt",
                    "key"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/keys/{id}": {
      "delete": {
        "operationId": "organisation.keys.revoke",
        "tags": [
          "organisation"
        ],
        "summary": "Revokes a key. Calls with it answer 401 from now on.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of an organisation>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/webhook": {
      "get": {
        "operationId": "organisation.webhook.get",
        "tags": [
          "organisation"
        ],
        "summary": "The webhook, when one is set.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        },
                        "secret": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "url",
                        "createdAt"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "organisation.webhook.set",
        "tags": [
          "organisation"
        ],
        "summary": "Sets or replaces the webhook. The secret that signs every delivery is shown here and derived from the id, so replacing the URL keeps it.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": [
                  "url"
                ]
              },
              "example": {
                "url": "https://agentheim.com/hooks/care"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "secret": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "url",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "organisation.webhook.remove",
        "tags": [
          "organisation"
        ],
        "summary": "Removes the webhook and its deliveries.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/webhook/deliveries": {
      "get": {
        "operationId": "organisation.webhook.deliveries",
        "tags": [
          "organisation"
        ],
        "summary": "What has been sent to the webhook, newest first: attempts, the last status, when the next try is due.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "orderId": {
                        "type": "string"
                      },
                      "event": {
                        "type": "string"
                      },
                      "attempts": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "deliveredAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "nextAttemptAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "lastStatus": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "lastError": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "orderId",
                      "event",
                      "attempts",
                      "deliveredAt",
                      "nextAttemptAt",
                      "lastStatus",
                      "lastError"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/clients": {
      "get": {
        "operationId": "organisation.clients.list",
        "tags": [
          "organisation"
        ],
        "summary": "The organisation's clients, newest first.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "email": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "birthDate": {
                        "type": "string",
                        "format": "date",
                        "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])))$"
                      },
                      "location": {
                        "type": "object",
                        "properties": {
                          "country": {
                            "type": "string",
                            "pattern": "^[A-Z]{2}$"
                          },
                          "region": {
                            "type": "string",
                            "pattern": "^[A-Z0-9]{1,3}$"
                          }
                        },
                        "required": [
                          "country"
                        ],
                        "additionalProperties": false
                      },
                      "language": {
                        "type": "string",
                        "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                      },
                      "currency": {
                        "type": "string",
                        "enum": [
                          "USD",
                          "EUR"
                        ]
                      },
                      "healthConsent": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "version": {
                                "type": "string"
                              },
                              "at": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "version",
                              "at"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "organisationId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "createdAt": {
                        "type": "string"
                      },
                      "externalRef": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "email",
                      "birthDate",
                      "location",
                      "language",
                      "currency",
                      "healthConsent",
                      "organisationId",
                      "createdAt",
                      "externalRef"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "organisation.clients.create",
        "tags": [
          "organisation"
        ],
        "summary": "A client under the organisation's own reference, with what the rules need. No sign-in of their own.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "externalRef": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "description": "The organisation's own id for the client, unique within the organisation."
                  },
                  "birthDate": {
                    "type": "string",
                    "format": "date",
                    "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])))$"
                  },
                  "location": {
                    "type": "object",
                    "properties": {
                      "country": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$"
                      },
                      "region": {
                        "type": "string",
                        "pattern": "^[A-Z0-9]{1,3}$"
                      }
                    },
                    "required": [
                      "country"
                    ]
                  },
                  "language": {
                    "type": "string",
                    "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                  },
                  "healthConsent": {
                    "type": "boolean",
                    "const": true,
                    "description": "The organisation has obtained the client's explicit consent to the Health data notice (version 2026-09-24) and holds the record."
                  }
                },
                "required": [
                  "externalRef",
                  "birthDate",
                  "location",
                  "language",
                  "healthConsent"
                ]
              },
              "example": {
                "externalRef": "user-8842",
                "birthDate": "1984-03-12",
                "location": {
                  "country": "DE"
                },
                "language": "de",
                "healthConsent": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "email": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "birthDate": {
                      "type": "string",
                      "format": "date",
                      "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])))$"
                    },
                    "location": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string",
                          "pattern": "^[A-Z]{2}$"
                        },
                        "region": {
                          "type": "string",
                          "pattern": "^[A-Z0-9]{1,3}$"
                        }
                      },
                      "required": [
                        "country"
                      ],
                      "additionalProperties": false
                    },
                    "language": {
                      "type": "string",
                      "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "healthConsent": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "version": {
                              "type": "string"
                            },
                            "at": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "version",
                            "at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organisationId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "externalRef": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "birthDate",
                    "location",
                    "language",
                    "currency",
                    "healthConsent",
                    "organisationId",
                    "createdAt",
                    "externalRef"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/clients/{id}": {
      "get": {
        "operationId": "organisation.clients.get",
        "tags": [
          "organisation"
        ],
        "summary": "One client of the organisation, by our id.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "email": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "birthDate": {
                      "type": "string",
                      "format": "date",
                      "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])))$"
                    },
                    "location": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string",
                          "pattern": "^[A-Z]{2}$"
                        },
                        "region": {
                          "type": "string",
                          "pattern": "^[A-Z0-9]{1,3}$"
                        }
                      },
                      "required": [
                        "country"
                      ],
                      "additionalProperties": false
                    },
                    "language": {
                      "type": "string",
                      "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "healthConsent": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "version": {
                              "type": "string"
                            },
                            "at": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "version",
                            "at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organisationId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "externalRef": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "birthDate",
                    "location",
                    "language",
                    "currency",
                    "healthConsent",
                    "organisationId",
                    "createdAt",
                    "externalRef"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "organisation.clients.update",
        "tags": [
          "organisation"
        ],
        "summary": "Birth date, location, language of a client.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "birthDate": {
                    "type": "string",
                    "format": "date",
                    "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])))$"
                  },
                  "location": {
                    "type": "object",
                    "properties": {
                      "country": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$"
                      },
                      "region": {
                        "type": "string",
                        "pattern": "^[A-Z0-9]{1,3}$"
                      }
                    },
                    "required": [
                      "country"
                    ]
                  },
                  "language": {
                    "type": "string",
                    "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                  }
                }
              },
              "example": {
                "language": "en"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "email": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "birthDate": {
                      "type": "string",
                      "format": "date",
                      "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])))$"
                    },
                    "location": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string",
                          "pattern": "^[A-Z]{2}$"
                        },
                        "region": {
                          "type": "string",
                          "pattern": "^[A-Z0-9]{1,3}$"
                        }
                      },
                      "required": [
                        "country"
                      ],
                      "additionalProperties": false
                    },
                    "language": {
                      "type": "string",
                      "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "healthConsent": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "version": {
                              "type": "string"
                            },
                            "at": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "version",
                            "at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organisationId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "externalRef": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "birthDate",
                    "location",
                    "language",
                    "currency",
                    "healthConsent",
                    "organisationId",
                    "createdAt",
                    "externalRef"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "organisation.clients.remove",
        "tags": [
          "organisation"
        ],
        "summary": "Deletes the client: the reference, birth date and every order's brief and document are erased, an open order refused. Charges stay for the books.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/clients/{id}/orders": {
      "get": {
        "operationId": "organisation.orders.list",
        "tags": [
          "organisation"
        ],
        "summary": "A client's orders with status and price, never the review.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "protocol": {
                        "type": "string"
                      },
                      "professions": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "queued",
                          "assigned",
                          "reviewed",
                          "refused"
                        ]
                      },
                      "professionalId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "priceCents": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "currency": {
                        "type": "string",
                        "enum": [
                          "USD",
                          "EUR"
                        ]
                      },
                      "createdAt": {
                        "type": "string"
                      },
                      "claimedAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "reviewedAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "clientId": {
                        "type": "string"
                      },
                      "clientRef": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "protocol",
                      "professions",
                      "status",
                      "professionalId",
                      "priceCents",
                      "currency",
                      "createdAt",
                      "claimedAt",
                      "reviewedAt",
                      "clientId",
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/clients/{id}/orders/{orderId}": {
      "get": {
        "operationId": "organisation.orders.get",
        "tags": [
          "organisation"
        ],
        "summary": "One order of a client, status and price, never the review.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          },
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string"
                    },
                    "professions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "assigned",
                        "reviewed",
                        "refused"
                      ]
                    },
                    "professionalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "priceCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reviewedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "clientId": {
                      "type": "string"
                    },
                    "clientRef": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "protocol",
                    "professions",
                    "status",
                    "professionalId",
                    "priceCents",
                    "currency",
                    "createdAt",
                    "claimedAt",
                    "reviewedAt",
                    "clientId",
                    "clientRef"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/clients/{id}/orders/plan": {
      "post": {
        "operationId": "organisation.orders.place.plan",
        "tags": [
          "organisation"
        ],
        "summary": "A plan for the period ahead from a professional who has read the client's SMART goals, health context and recent logs: a FITT-VP training plan from a personal trainer, an eating plan from a nutrition coach. Placed on the client's behalf, charged to the organisation's pot.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$",
              "description": "The client, by our id."
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "professions": {
                    "minItems": 1,
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "requestedProfessionalId": {
                    "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)$"
                  },
                  "brief": {
                    "type": "object",
                    "properties": {
                      "period": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "health": {
                        "type": "object",
                        "properties": {
                          "parq": {
                            "type": "object",
                            "properties": {
                              "heartOrBloodPressure": {
                                "type": "boolean",
                                "description": "1. Has your doctor ever said that you have a heart condition OR high blood pressure?"
                              },
                              "chestPain": {
                                "type": "boolean",
                                "description": "2. Do you feel pain in your chest at rest, during your daily activities of living, OR when you do physical activity?"
                              },
                              "dizzinessOrFainting": {
                                "type": "boolean",
                                "description": "3. Do you lose balance because of dizziness OR have you lost consciousness in the last 12 months?"
                              },
                              "otherChronicCondition": {
                                "type": "boolean",
                                "description": "4. Have you ever been diagnosed with another chronic medical condition (other than heart disease or high blood pressure)?"
                              },
                              "prescribedMedication": {
                                "type": "boolean",
                                "description": "5. Are you currently taking prescribed medications for a chronic medical condition?"
                              },
                              "boneJointSoftTissue": {
                                "type": "boolean",
                                "description": "6. Do you currently have (or have had within the past 12 months) a bone, joint, or soft tissue (muscle, ligament, or tendon) problem that could be made worse by becoming more physically active?"
                              },
                              "supervisedOnly": {
                                "type": "boolean",
                                "description": "7. Has your doctor ever said that you should only do medically supervised physical activity?"
                              },
                              "pregnant": {
                                "type": "boolean",
                                "description": "8. Are you pregnant?"
                              },
                              "eatingDisorder": {
                                "type": "boolean",
                                "description": "9. Do you have, or have you had, an eating disorder? A yes puts the service outside what we may offer."
                              },
                              "clinicianCleared": {
                                "description": "Only when any answer above is YES: has a doctor or another clinician said that you may be physically active? Leave out when every answer is no.",
                                "type": "boolean"
                              },
                              "declaredOn": {
                                "type": "string",
                                "format": "date",
                                "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])))$",
                                "description": "The date the client answered these questions themselves. The declaration is the client's own, never inferred."
                              }
                            },
                            "required": [
                              "heartOrBloodPressure",
                              "chestPain",
                              "dizzinessOrFainting",
                              "otherChronicCondition",
                              "prescribedMedication",
                              "boneJointSoftTissue",
                              "supervisedOnly",
                              "pregnant",
                              "eatingDisorder",
                              "declaredOn"
                            ],
                            "description": "The health declaration: nine questions, the clearance, and the date the client answered."
                          },
                          "diagnoses": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 80,
                                  "description": "As the clinician named it, in the client's words: type 2 diabetes, asthma, high blood pressure."
                                },
                                "since": {
                                  "type": "string",
                                  "format": "date",
                                  "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])))$"
                                },
                                "underCare": {
                                  "type": "boolean",
                                  "description": "Under a clinician's care now."
                                }
                              },
                              "required": [
                                "name",
                                "underCare"
                              ]
                            },
                            "description": "The chronic conditions a clinician has diagnosed, named, behind a yes on question 4."
                          },
                          "medications": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 80
                            },
                            "description": "Prescribed medications by name, behind a yes on question 5."
                          },
                          "conditions": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "area": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 40,
                                  "description": "Where: wrist, lower back, knee, or general."
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 3,
                                  "maxLength": 300,
                                  "description": "What it is like, in the client's words."
                                },
                                "since": {
                                  "type": "string",
                                  "format": "date",
                                  "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])))$"
                                },
                                "severity": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 5,
                                  "description": "1 (notices it) to 5 (stops the activity)."
                                },
                                "clinicianCleared": {
                                  "type": "boolean",
                                  "description": "A clinician has seen it and said training around it is fine."
                                }
                              },
                              "required": [
                                "area",
                                "description",
                                "severity",
                                "clinicianCleared"
                              ]
                            },
                            "description": "Injuries, aches and problems with bones, joints or muscles the professional plans around, one entry each, behind a yes on question 6 or on their own."
                          }
                        },
                        "required": [
                          "parq",
                          "diagnoses",
                          "medications",
                          "conditions"
                        ]
                      },
                      "body": {
                        "type": "object",
                        "properties": {
                          "sex": {
                            "type": "string",
                            "enum": [
                              "female",
                              "male",
                              "other"
                            ],
                            "description": "For the norm tables: female, male, or other when neither table fits."
                          },
                          "heightCm": {
                            "type": "number",
                            "minimum": 100,
                            "maximum": 250,
                            "description": "Centimetres."
                          },
                          "weightKg": {
                            "type": "number",
                            "minimum": 30,
                            "maximum": 300,
                            "description": "Kilograms."
                          },
                          "waistCm": {
                            "description": "Centimetres, at the navel.",
                            "type": "number",
                            "minimum": 40,
                            "maximum": 200
                          },
                          "date": {
                            "description": "When the weight and waist were taken.",
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          }
                        },
                        "required": [
                          "sex",
                          "heightCm",
                          "weightKg"
                        ]
                      },
                      "fitness": {
                        "type": "object",
                        "properties": {
                          "experience": {
                            "type": "string",
                            "enum": [
                              "beginner",
                              "intermediate",
                              "advanced",
                              "elite"
                            ],
                            "description": "NSCA training status: beginner (under two months), intermediate, advanced (a year or more), elite (competing)."
                          },
                          "activity": {
                            "type": "object",
                            "properties": {
                              "daysPerWeek": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 7
                              },
                              "minutesPerSession": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 600
                              },
                              "since": {
                                "description": "ISO date this pattern has held since; omitted when it is new.",
                                "type": "string",
                                "format": "date",
                                "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])))$"
                              }
                            },
                            "required": [
                              "daysPerWeek",
                              "minutesPerSession"
                            ],
                            "description": "What the client does now, against ACSM's regular exerciser: 30 minutes or more of moderate activity, three or more days a week, for three months or more."
                          },
                          "strength": {
                            "description": "What the client knows about their strength. Only what they know; nothing is tested for this.",
                            "type": "object",
                            "properties": {
                              "squatKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 500
                              },
                              "benchKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 400
                              },
                              "deadliftKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 500
                              },
                              "pushUps": {
                                "description": "Most in one set.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 200
                              },
                              "pullUps": {
                                "description": "Most in one set.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 100
                              }
                            }
                          },
                          "endurance": {
                            "type": "object",
                            "properties": {
                              "fiveKmMinutes": {
                                "description": "Recent 5 km time in minutes, decimals allowed: 22.5 is 22:30.",
                                "type": "number",
                                "minimum": 10,
                                "maximum": 120
                              },
                              "restingHeartRate": {
                                "description": "Beats per minute, at rest in the morning.",
                                "type": "integer",
                                "minimum": 30,
                                "maximum": 120
                              },
                              "notes": {
                                "description": "In the client's words: walks 5 km without stopping, cycles to work.",
                                "type": "string",
                                "maxLength": 300
                              }
                            }
                          },
                          "mobility": {
                            "description": "In the client's words: cannot squat below parallel, tight hips.",
                            "type": "string",
                            "maxLength": 300
                          },
                          "equipment": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "description": "dumbbells to 20 kg, gym, none, bike."
                          },
                          "daysAvailable": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 7,
                            "description": "Days a week the plan may use."
                          },
                          "minutesAvailable": {
                            "type": "integer",
                            "minimum": 10,
                            "maximum": 300,
                            "description": "Minutes per session the plan may use."
                          }
                        },
                        "required": [
                          "experience",
                          "activity",
                          "equipment",
                          "daysAvailable",
                          "minutesAvailable"
                        ]
                      },
                      "diet": {
                        "type": "object",
                        "properties": {
                          "pattern": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 60,
                            "description": "omnivore, pescatarian, vegetarian, vegan, or the client's own word: halal, kosher, low FODMAP by choice."
                          },
                          "allergies": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "food": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 60
                                },
                                "clinicianDiagnosed": {
                                  "type": "boolean",
                                  "description": "A clinician has diagnosed it, as against the client's own observation."
                                }
                              },
                              "required": [
                                "food",
                                "clinicianDiagnosed"
                              ]
                            },
                            "description": "Foods that cause a reaction. Avoided in every plan."
                          },
                          "intolerances": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "description": "Foods the client does not tolerate, in their own experience: stone fruit, lactose."
                          },
                          "dislikes": {
                            "maxItems": 30,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            }
                          },
                          "mealsPerDay": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 8,
                            "description": "Meals on an ordinary day, snacks not counted."
                          },
                          "cookingMinutes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 240,
                            "description": "Minutes the client will cook on an ordinary day."
                          },
                          "cookingSkill": {
                            "type": "string",
                            "enum": [
                              "none",
                              "basic",
                              "confident"
                            ]
                          },
                          "caffeine": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 20,
                            "description": "Cups of coffee, or the equivalent in tea or energy drinks, per day."
                          },
                          "alcohol": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100,
                            "description": "Standard drinks per week: one glass of wine, one bottle of beer, one shot each count as one."
                          },
                          "notes": {
                            "description": "Budget, family meals, shift work, in the client's words.",
                            "type": "string",
                            "maxLength": 500
                          }
                        },
                        "required": [
                          "pattern",
                          "allergies",
                          "intolerances",
                          "dislikes",
                          "mealsPerDay",
                          "cookingMinutes",
                          "cookingSkill",
                          "caffeine",
                          "alcohol"
                        ]
                      },
                      "labs": {
                        "maxItems": 40,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "marker": {
                              "type": "string",
                              "enum": [
                                "total-cholesterol",
                                "ldl",
                                "hdl",
                                "triglycerides",
                                "hba1c",
                                "fasting-glucose",
                                "ferritin",
                                "vitamin-d",
                                "blood-pressure",
                                "resting-heart-rate",
                                "other"
                              ]
                            },
                            "name": {
                              "description": "Named when the marker is other.",
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "value": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 20,
                              "description": "As on the lab report: 4.8, or 130/85 for blood pressure."
                            },
                            "unit": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 20,
                              "description": "As on the lab report: mmol/L, mg/dL, mmHg, bpm. Ask when the client gives a number without one; a value without its unit means nothing."
                            },
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "clinicianReviewed": {
                              "type": "boolean",
                              "description": "A clinician took it or has seen it."
                            }
                          },
                          "required": [
                            "marker",
                            "value",
                            "unit",
                            "date",
                            "clinicianReviewed"
                          ]
                        }
                      },
                      "goals": {
                        "minItems": 1,
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string",
                              "minLength": 3,
                              "maxLength": 300,
                              "description": "Specific: what, in the client's words."
                            },
                            "measure": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 100,
                              "description": "Measurable: what is measured. 5 km time, deadlift 1RM, waist, energy on a 1 to 5 scale."
                            },
                            "target": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100,
                              "description": "The target value with its unit: under 30 min, 100 kg, 4 or better most days."
                            },
                            "by": {
                              "type": "string",
                              "format": "date",
                              "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])))$",
                              "description": "Time bound: the date."
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "performance",
                                "wellbeing",
                                "condition"
                              ],
                              "description": "performance (stronger, faster, further), wellbeing (energy, sleep, weight for its own sake), condition (aimed at a disease or an injury; a clinician's, refused here)."
                            }
                          },
                          "required": [
                            "text",
                            "measure",
                            "target",
                            "by",
                            "kind"
                          ]
                        }
                      },
                      "sessions": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "type": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 40,
                              "description": "strength, run, walk, cycle, swim, mobility, or the client's own word."
                            },
                            "minutes": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 600
                            },
                            "rpe": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 10,
                              "description": "Borg CR10, 0 (rest) to 10 (maximal), for the whole session, asked about 30 minutes after it."
                            },
                            "exercises": {
                              "maxItems": 30,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "exercise": {
                                    "type": "string",
                                    "minLength": 2,
                                    "maxLength": 80
                                  },
                                  "sets": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 20
                                  },
                                  "reps": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                  },
                                  "load": {
                                    "description": "In kg, or as the client wrote it: bodyweight, 70%, RPE 8.",
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 30
                                  }
                                },
                                "required": [
                                  "exercise",
                                  "sets",
                                  "reps"
                                ]
                              }
                            },
                            "notes": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "required": [
                            "date",
                            "type",
                            "minutes",
                            "rpe"
                          ]
                        }
                      },
                      "wellbeing": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "sleep": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "Sleep quality last night, 1 (very, very good) to 7 (very, very bad)."
                            },
                            "fatigue": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "1 (very, very low) to 7 (very, very high)."
                            },
                            "stress": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "1 (very, very low) to 7 (very, very high)."
                            },
                            "soreness": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "Muscle soreness, 1 (very, very low) to 7 (very, very high)."
                            }
                          },
                          "required": [
                            "date",
                            "sleep",
                            "fatigue",
                            "stress",
                            "soreness"
                          ]
                        }
                      },
                      "food": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "meals": {
                              "maxItems": 12,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "time": {
                                    "type": "string",
                                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "24 hour clock: 07:30."
                                  },
                                  "items": {
                                    "minItems": 1,
                                    "maxItems": 20,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 2,
                                      "maxLength": 200
                                    },
                                    "description": "In household measures: 2 eggs, 2 slices rye bread, butter, coffee with milk."
                                  },
                                  "context": {
                                    "description": "Before or after training, at a restaurant, in the client's words.",
                                    "type": "string",
                                    "maxLength": 200
                                  }
                                },
                                "required": [
                                  "time",
                                  "items"
                                ]
                              }
                            },
                            "notes": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "required": [
                            "date",
                            "meals"
                          ]
                        }
                      },
                      "notes": {
                        "type": "string",
                        "maxLength": 2000
                      }
                    },
                    "required": [
                      "period",
                      "health",
                      "body",
                      "goals"
                    ]
                  }
                },
                "required": [
                  "professions",
                  "brief"
                ]
              },
              "example": {
                "professions": [
                  "personal-trainer"
                ],
                "brief": {
                  "period": {
                    "from": "2026-10-01",
                    "to": "2026-10-07"
                  },
                  "health": {
                    "parq": {
                      "heartOrBloodPressure": false,
                      "chestPain": false,
                      "dizzinessOrFainting": false,
                      "otherChronicCondition": false,
                      "prescribedMedication": false,
                      "boneJointSoftTissue": false,
                      "supervisedOnly": false,
                      "pregnant": false,
                      "eatingDisorder": false,
                      "declaredOn": "2026-09-20"
                    },
                    "diagnoses": [],
                    "medications": [],
                    "conditions": []
                  },
                  "body": {
                    "sex": "female",
                    "heightCm": 168,
                    "weightKg": 64
                  },
                  "fitness": {
                    "experience": "intermediate",
                    "activity": {
                      "daysPerWeek": 3,
                      "minutesPerSession": 45
                    },
                    "equipment": [
                      "dumbbells to 20 kg"
                    ],
                    "daysAvailable": 3,
                    "minutesAvailable": 60
                  },
                  "diet": {
                    "pattern": "omnivore",
                    "allergies": [],
                    "intolerances": [
                      "stone fruit"
                    ],
                    "dislikes": [],
                    "mealsPerDay": 3,
                    "cookingMinutes": 30,
                    "cookingSkill": "basic",
                    "caffeine": 2,
                    "alcohol": 1
                  },
                  "goals": [
                    {
                      "text": "Run 10 km",
                      "measure": "distance in one run",
                      "target": "10 km",
                      "by": "2026-12-31",
                      "kind": "performance"
                    }
                  ],
                  "notes": "Three days a week, dumbbells at home."
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string"
                    },
                    "professions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "assigned",
                        "reviewed",
                        "refused"
                      ]
                    },
                    "screening": {
                      "type": "object",
                      "properties": {
                        "tier": {
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 1
                            },
                            {
                              "type": "number",
                              "const": 2
                            },
                            {
                              "type": "number",
                              "const": 3
                            }
                          ]
                        },
                        "flags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "tier",
                        "flags"
                      ],
                      "additionalProperties": false
                    },
                    "verdict": {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "refused",
                            "clearance"
                          ]
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "ok"
                      ],
                      "additionalProperties": false
                    },
                    "professionalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "review": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "markdown": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "markdown"
                            ],
                            "additionalProperties": false
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "priceCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reviewedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "protocol",
                    "professions",
                    "status",
                    "screening",
                    "verdict",
                    "professionalId",
                    "review",
                    "priceCents",
                    "currency",
                    "createdAt",
                    "claimedAt",
                    "reviewedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/clients/{id}/orders/evaluate": {
      "post": {
        "operationId": "organisation.orders.place.evaluate",
        "tags": [
          "organisation"
        ],
        "summary": "A professional's reading of the period that passed: the session-RPE log, the Hooper index and the food record against the SMART goals and the plan; adherence, load, wellbeing, each goal's status, what went well, what to change, what comes next. Placed on the client's behalf, charged to the organisation's pot.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$",
              "description": "The client, by our id."
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "professions": {
                    "minItems": 1,
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "requestedProfessionalId": {
                    "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)$"
                  },
                  "brief": {
                    "type": "object",
                    "properties": {
                      "period": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "health": {
                        "type": "object",
                        "properties": {
                          "parq": {
                            "type": "object",
                            "properties": {
                              "heartOrBloodPressure": {
                                "type": "boolean",
                                "description": "1. Has your doctor ever said that you have a heart condition OR high blood pressure?"
                              },
                              "chestPain": {
                                "type": "boolean",
                                "description": "2. Do you feel pain in your chest at rest, during your daily activities of living, OR when you do physical activity?"
                              },
                              "dizzinessOrFainting": {
                                "type": "boolean",
                                "description": "3. Do you lose balance because of dizziness OR have you lost consciousness in the last 12 months?"
                              },
                              "otherChronicCondition": {
                                "type": "boolean",
                                "description": "4. Have you ever been diagnosed with another chronic medical condition (other than heart disease or high blood pressure)?"
                              },
                              "prescribedMedication": {
                                "type": "boolean",
                                "description": "5. Are you currently taking prescribed medications for a chronic medical condition?"
                              },
                              "boneJointSoftTissue": {
                                "type": "boolean",
                                "description": "6. Do you currently have (or have had within the past 12 months) a bone, joint, or soft tissue (muscle, ligament, or tendon) problem that could be made worse by becoming more physically active?"
                              },
                              "supervisedOnly": {
                                "type": "boolean",
                                "description": "7. Has your doctor ever said that you should only do medically supervised physical activity?"
                              },
                              "pregnant": {
                                "type": "boolean",
                                "description": "8. Are you pregnant?"
                              },
                              "eatingDisorder": {
                                "type": "boolean",
                                "description": "9. Do you have, or have you had, an eating disorder? A yes puts the service outside what we may offer."
                              },
                              "clinicianCleared": {
                                "description": "Only when any answer above is YES: has a doctor or another clinician said that you may be physically active? Leave out when every answer is no.",
                                "type": "boolean"
                              },
                              "declaredOn": {
                                "type": "string",
                                "format": "date",
                                "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])))$",
                                "description": "The date the client answered these questions themselves. The declaration is the client's own, never inferred."
                              }
                            },
                            "required": [
                              "heartOrBloodPressure",
                              "chestPain",
                              "dizzinessOrFainting",
                              "otherChronicCondition",
                              "prescribedMedication",
                              "boneJointSoftTissue",
                              "supervisedOnly",
                              "pregnant",
                              "eatingDisorder",
                              "declaredOn"
                            ],
                            "description": "The health declaration: nine questions, the clearance, and the date the client answered."
                          },
                          "diagnoses": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 80,
                                  "description": "As the clinician named it, in the client's words: type 2 diabetes, asthma, high blood pressure."
                                },
                                "since": {
                                  "type": "string",
                                  "format": "date",
                                  "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])))$"
                                },
                                "underCare": {
                                  "type": "boolean",
                                  "description": "Under a clinician's care now."
                                }
                              },
                              "required": [
                                "name",
                                "underCare"
                              ]
                            },
                            "description": "The chronic conditions a clinician has diagnosed, named, behind a yes on question 4."
                          },
                          "medications": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 80
                            },
                            "description": "Prescribed medications by name, behind a yes on question 5."
                          },
                          "conditions": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "area": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 40,
                                  "description": "Where: wrist, lower back, knee, or general."
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 3,
                                  "maxLength": 300,
                                  "description": "What it is like, in the client's words."
                                },
                                "since": {
                                  "type": "string",
                                  "format": "date",
                                  "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])))$"
                                },
                                "severity": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 5,
                                  "description": "1 (notices it) to 5 (stops the activity)."
                                },
                                "clinicianCleared": {
                                  "type": "boolean",
                                  "description": "A clinician has seen it and said training around it is fine."
                                }
                              },
                              "required": [
                                "area",
                                "description",
                                "severity",
                                "clinicianCleared"
                              ]
                            },
                            "description": "Injuries, aches and problems with bones, joints or muscles the professional plans around, one entry each, behind a yes on question 6 or on their own."
                          }
                        },
                        "required": [
                          "parq",
                          "diagnoses",
                          "medications",
                          "conditions"
                        ]
                      },
                      "body": {
                        "type": "object",
                        "properties": {
                          "sex": {
                            "type": "string",
                            "enum": [
                              "female",
                              "male",
                              "other"
                            ],
                            "description": "For the norm tables: female, male, or other when neither table fits."
                          },
                          "heightCm": {
                            "type": "number",
                            "minimum": 100,
                            "maximum": 250,
                            "description": "Centimetres."
                          },
                          "weightKg": {
                            "type": "number",
                            "minimum": 30,
                            "maximum": 300,
                            "description": "Kilograms."
                          },
                          "waistCm": {
                            "description": "Centimetres, at the navel.",
                            "type": "number",
                            "minimum": 40,
                            "maximum": 200
                          },
                          "date": {
                            "description": "When the weight and waist were taken.",
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          }
                        },
                        "required": [
                          "sex",
                          "heightCm",
                          "weightKg"
                        ]
                      },
                      "fitness": {
                        "type": "object",
                        "properties": {
                          "experience": {
                            "type": "string",
                            "enum": [
                              "beginner",
                              "intermediate",
                              "advanced",
                              "elite"
                            ],
                            "description": "NSCA training status: beginner (under two months), intermediate, advanced (a year or more), elite (competing)."
                          },
                          "activity": {
                            "type": "object",
                            "properties": {
                              "daysPerWeek": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 7
                              },
                              "minutesPerSession": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 600
                              },
                              "since": {
                                "description": "ISO date this pattern has held since; omitted when it is new.",
                                "type": "string",
                                "format": "date",
                                "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])))$"
                              }
                            },
                            "required": [
                              "daysPerWeek",
                              "minutesPerSession"
                            ],
                            "description": "What the client does now, against ACSM's regular exerciser: 30 minutes or more of moderate activity, three or more days a week, for three months or more."
                          },
                          "strength": {
                            "description": "What the client knows about their strength. Only what they know; nothing is tested for this.",
                            "type": "object",
                            "properties": {
                              "squatKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 500
                              },
                              "benchKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 400
                              },
                              "deadliftKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 500
                              },
                              "pushUps": {
                                "description": "Most in one set.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 200
                              },
                              "pullUps": {
                                "description": "Most in one set.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 100
                              }
                            }
                          },
                          "endurance": {
                            "type": "object",
                            "properties": {
                              "fiveKmMinutes": {
                                "description": "Recent 5 km time in minutes, decimals allowed: 22.5 is 22:30.",
                                "type": "number",
                                "minimum": 10,
                                "maximum": 120
                              },
                              "restingHeartRate": {
                                "description": "Beats per minute, at rest in the morning.",
                                "type": "integer",
                                "minimum": 30,
                                "maximum": 120
                              },
                              "notes": {
                                "description": "In the client's words: walks 5 km without stopping, cycles to work.",
                                "type": "string",
                                "maxLength": 300
                              }
                            }
                          },
                          "mobility": {
                            "description": "In the client's words: cannot squat below parallel, tight hips.",
                            "type": "string",
                            "maxLength": 300
                          },
                          "equipment": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "description": "dumbbells to 20 kg, gym, none, bike."
                          },
                          "daysAvailable": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 7,
                            "description": "Days a week the plan may use."
                          },
                          "minutesAvailable": {
                            "type": "integer",
                            "minimum": 10,
                            "maximum": 300,
                            "description": "Minutes per session the plan may use."
                          }
                        },
                        "required": [
                          "experience",
                          "activity",
                          "equipment",
                          "daysAvailable",
                          "minutesAvailable"
                        ]
                      },
                      "diet": {
                        "type": "object",
                        "properties": {
                          "pattern": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 60,
                            "description": "omnivore, pescatarian, vegetarian, vegan, or the client's own word: halal, kosher, low FODMAP by choice."
                          },
                          "allergies": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "food": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 60
                                },
                                "clinicianDiagnosed": {
                                  "type": "boolean",
                                  "description": "A clinician has diagnosed it, as against the client's own observation."
                                }
                              },
                              "required": [
                                "food",
                                "clinicianDiagnosed"
                              ]
                            },
                            "description": "Foods that cause a reaction. Avoided in every plan."
                          },
                          "intolerances": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "description": "Foods the client does not tolerate, in their own experience: stone fruit, lactose."
                          },
                          "dislikes": {
                            "maxItems": 30,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            }
                          },
                          "mealsPerDay": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 8,
                            "description": "Meals on an ordinary day, snacks not counted."
                          },
                          "cookingMinutes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 240,
                            "description": "Minutes the client will cook on an ordinary day."
                          },
                          "cookingSkill": {
                            "type": "string",
                            "enum": [
                              "none",
                              "basic",
                              "confident"
                            ]
                          },
                          "caffeine": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 20,
                            "description": "Cups of coffee, or the equivalent in tea or energy drinks, per day."
                          },
                          "alcohol": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100,
                            "description": "Standard drinks per week: one glass of wine, one bottle of beer, one shot each count as one."
                          },
                          "notes": {
                            "description": "Budget, family meals, shift work, in the client's words.",
                            "type": "string",
                            "maxLength": 500
                          }
                        },
                        "required": [
                          "pattern",
                          "allergies",
                          "intolerances",
                          "dislikes",
                          "mealsPerDay",
                          "cookingMinutes",
                          "cookingSkill",
                          "caffeine",
                          "alcohol"
                        ]
                      },
                      "labs": {
                        "maxItems": 40,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "marker": {
                              "type": "string",
                              "enum": [
                                "total-cholesterol",
                                "ldl",
                                "hdl",
                                "triglycerides",
                                "hba1c",
                                "fasting-glucose",
                                "ferritin",
                                "vitamin-d",
                                "blood-pressure",
                                "resting-heart-rate",
                                "other"
                              ]
                            },
                            "name": {
                              "description": "Named when the marker is other.",
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "value": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 20,
                              "description": "As on the lab report: 4.8, or 130/85 for blood pressure."
                            },
                            "unit": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 20,
                              "description": "As on the lab report: mmol/L, mg/dL, mmHg, bpm. Ask when the client gives a number without one; a value without its unit means nothing."
                            },
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "clinicianReviewed": {
                              "type": "boolean",
                              "description": "A clinician took it or has seen it."
                            }
                          },
                          "required": [
                            "marker",
                            "value",
                            "unit",
                            "date",
                            "clinicianReviewed"
                          ]
                        }
                      },
                      "goals": {
                        "minItems": 1,
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string",
                              "minLength": 3,
                              "maxLength": 300,
                              "description": "Specific: what, in the client's words."
                            },
                            "measure": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 100,
                              "description": "Measurable: what is measured. 5 km time, deadlift 1RM, waist, energy on a 1 to 5 scale."
                            },
                            "target": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100,
                              "description": "The target value with its unit: under 30 min, 100 kg, 4 or better most days."
                            },
                            "by": {
                              "type": "string",
                              "format": "date",
                              "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])))$",
                              "description": "Time bound: the date."
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "performance",
                                "wellbeing",
                                "condition"
                              ],
                              "description": "performance (stronger, faster, further), wellbeing (energy, sleep, weight for its own sake), condition (aimed at a disease or an injury; a clinician's, refused here)."
                            }
                          },
                          "required": [
                            "text",
                            "measure",
                            "target",
                            "by",
                            "kind"
                          ]
                        }
                      },
                      "sessions": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "type": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 40,
                              "description": "strength, run, walk, cycle, swim, mobility, or the client's own word."
                            },
                            "minutes": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 600
                            },
                            "rpe": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 10,
                              "description": "Borg CR10, 0 (rest) to 10 (maximal), for the whole session, asked about 30 minutes after it."
                            },
                            "exercises": {
                              "maxItems": 30,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "exercise": {
                                    "type": "string",
                                    "minLength": 2,
                                    "maxLength": 80
                                  },
                                  "sets": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 20
                                  },
                                  "reps": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                  },
                                  "load": {
                                    "description": "In kg, or as the client wrote it: bodyweight, 70%, RPE 8.",
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 30
                                  }
                                },
                                "required": [
                                  "exercise",
                                  "sets",
                                  "reps"
                                ]
                              }
                            },
                            "notes": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "required": [
                            "date",
                            "type",
                            "minutes",
                            "rpe"
                          ]
                        }
                      },
                      "wellbeing": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "sleep": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "Sleep quality last night, 1 (very, very good) to 7 (very, very bad)."
                            },
                            "fatigue": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "1 (very, very low) to 7 (very, very high)."
                            },
                            "stress": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "1 (very, very low) to 7 (very, very high)."
                            },
                            "soreness": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "Muscle soreness, 1 (very, very low) to 7 (very, very high)."
                            }
                          },
                          "required": [
                            "date",
                            "sleep",
                            "fatigue",
                            "stress",
                            "soreness"
                          ]
                        }
                      },
                      "food": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "meals": {
                              "maxItems": 12,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "time": {
                                    "type": "string",
                                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "24 hour clock: 07:30."
                                  },
                                  "items": {
                                    "minItems": 1,
                                    "maxItems": 20,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 2,
                                      "maxLength": 200
                                    },
                                    "description": "In household measures: 2 eggs, 2 slices rye bread, butter, coffee with milk."
                                  },
                                  "context": {
                                    "description": "Before or after training, at a restaurant, in the client's words.",
                                    "type": "string",
                                    "maxLength": 200
                                  }
                                },
                                "required": [
                                  "time",
                                  "items"
                                ]
                              }
                            },
                            "notes": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "required": [
                            "date",
                            "meals"
                          ]
                        }
                      },
                      "plan": {},
                      "notes": {
                        "type": "string",
                        "maxLength": 2000
                      }
                    },
                    "required": [
                      "period",
                      "health",
                      "body",
                      "goals"
                    ]
                  }
                },
                "required": [
                  "professions",
                  "brief"
                ]
              },
              "example": {
                "professions": [
                  "personal-trainer"
                ],
                "brief": {
                  "period": {
                    "from": "2026-10-01",
                    "to": "2026-10-07"
                  },
                  "health": {
                    "parq": {
                      "heartOrBloodPressure": false,
                      "chestPain": false,
                      "dizzinessOrFainting": false,
                      "otherChronicCondition": false,
                      "prescribedMedication": false,
                      "boneJointSoftTissue": false,
                      "supervisedOnly": false,
                      "pregnant": false,
                      "eatingDisorder": false,
                      "declaredOn": "2026-09-20"
                    },
                    "diagnoses": [],
                    "medications": [],
                    "conditions": []
                  },
                  "body": {
                    "sex": "female",
                    "heightCm": 168,
                    "weightKg": 64
                  },
                  "fitness": {
                    "experience": "intermediate",
                    "activity": {
                      "daysPerWeek": 3,
                      "minutesPerSession": 45
                    },
                    "equipment": [
                      "dumbbells to 20 kg"
                    ],
                    "daysAvailable": 3,
                    "minutesAvailable": 60
                  },
                  "diet": {
                    "pattern": "omnivore",
                    "allergies": [],
                    "intolerances": [
                      "stone fruit"
                    ],
                    "dislikes": [],
                    "mealsPerDay": 3,
                    "cookingMinutes": 30,
                    "cookingSkill": "basic",
                    "caffeine": 2,
                    "alcohol": 1
                  },
                  "goals": [
                    {
                      "text": "Run 10 km",
                      "measure": "distance in one run",
                      "target": "10 km",
                      "by": "2026-12-31",
                      "kind": "performance"
                    }
                  ],
                  "notes": "Three days a week, dumbbells at home.",
                  "plan": {
                    "personal-trainer": {
                      "markdown": "# Summary\nThree runs and two dumbbell sessions a week; the wrist stays neutral under load. \n\n# Weeks\n## Week 1\n### Day 1: run\nRPE 3, 30 minutes, easy.\n\n### Day 3: strength\nRPE 7, 45 minutes. Dumbbell row 3 x 10 at 14 kg, rest 90 s. Goblet squat 3 x 10.\n\n# Progression\nAdd five minutes to each run while RPE stays at 3; add one set to the rows in week three.\n\n# Adaptations\nNeutral grip on every press; no push-ups on the palm until the wrist settles.\n\n# Referral\nNone."
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string"
                    },
                    "professions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "assigned",
                        "reviewed",
                        "refused"
                      ]
                    },
                    "screening": {
                      "type": "object",
                      "properties": {
                        "tier": {
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 1
                            },
                            {
                              "type": "number",
                              "const": 2
                            },
                            {
                              "type": "number",
                              "const": 3
                            }
                          ]
                        },
                        "flags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "tier",
                        "flags"
                      ],
                      "additionalProperties": false
                    },
                    "verdict": {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "refused",
                            "clearance"
                          ]
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "ok"
                      ],
                      "additionalProperties": false
                    },
                    "professionalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "review": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "markdown": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "markdown"
                            ],
                            "additionalProperties": false
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "priceCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reviewedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "protocol",
                    "professions",
                    "status",
                    "screening",
                    "verdict",
                    "professionalId",
                    "review",
                    "priceCents",
                    "currency",
                    "createdAt",
                    "claimedAt",
                    "reviewedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/org/clients/{id}/orders/review-plan": {
      "post": {
        "operationId": "organisation.orders.place.review-plan",
        "tags": [
          "organisation"
        ],
        "summary": "A professional's review of a plan the client's agent wrote, in the profession's own plan standard: a verdict, findings with what to change, and what the plan must avoid. Placed on the client's behalf, charged to the organisation's pot.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <API key (cr_...) or session of an organisation>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$",
              "description": "The client, by our id."
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "professions": {
                    "minItems": 1,
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "requestedProfessionalId": {
                    "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)$"
                  },
                  "brief": {
                    "type": "object",
                    "properties": {
                      "period": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "health": {
                        "type": "object",
                        "properties": {
                          "parq": {
                            "type": "object",
                            "properties": {
                              "heartOrBloodPressure": {
                                "type": "boolean",
                                "description": "1. Has your doctor ever said that you have a heart condition OR high blood pressure?"
                              },
                              "chestPain": {
                                "type": "boolean",
                                "description": "2. Do you feel pain in your chest at rest, during your daily activities of living, OR when you do physical activity?"
                              },
                              "dizzinessOrFainting": {
                                "type": "boolean",
                                "description": "3. Do you lose balance because of dizziness OR have you lost consciousness in the last 12 months?"
                              },
                              "otherChronicCondition": {
                                "type": "boolean",
                                "description": "4. Have you ever been diagnosed with another chronic medical condition (other than heart disease or high blood pressure)?"
                              },
                              "prescribedMedication": {
                                "type": "boolean",
                                "description": "5. Are you currently taking prescribed medications for a chronic medical condition?"
                              },
                              "boneJointSoftTissue": {
                                "type": "boolean",
                                "description": "6. Do you currently have (or have had within the past 12 months) a bone, joint, or soft tissue (muscle, ligament, or tendon) problem that could be made worse by becoming more physically active?"
                              },
                              "supervisedOnly": {
                                "type": "boolean",
                                "description": "7. Has your doctor ever said that you should only do medically supervised physical activity?"
                              },
                              "pregnant": {
                                "type": "boolean",
                                "description": "8. Are you pregnant?"
                              },
                              "eatingDisorder": {
                                "type": "boolean",
                                "description": "9. Do you have, or have you had, an eating disorder? A yes puts the service outside what we may offer."
                              },
                              "clinicianCleared": {
                                "description": "Only when any answer above is YES: has a doctor or another clinician said that you may be physically active? Leave out when every answer is no.",
                                "type": "boolean"
                              },
                              "declaredOn": {
                                "type": "string",
                                "format": "date",
                                "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])))$",
                                "description": "The date the client answered these questions themselves. The declaration is the client's own, never inferred."
                              }
                            },
                            "required": [
                              "heartOrBloodPressure",
                              "chestPain",
                              "dizzinessOrFainting",
                              "otherChronicCondition",
                              "prescribedMedication",
                              "boneJointSoftTissue",
                              "supervisedOnly",
                              "pregnant",
                              "eatingDisorder",
                              "declaredOn"
                            ],
                            "description": "The health declaration: nine questions, the clearance, and the date the client answered."
                          },
                          "diagnoses": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 80,
                                  "description": "As the clinician named it, in the client's words: type 2 diabetes, asthma, high blood pressure."
                                },
                                "since": {
                                  "type": "string",
                                  "format": "date",
                                  "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])))$"
                                },
                                "underCare": {
                                  "type": "boolean",
                                  "description": "Under a clinician's care now."
                                }
                              },
                              "required": [
                                "name",
                                "underCare"
                              ]
                            },
                            "description": "The chronic conditions a clinician has diagnosed, named, behind a yes on question 4."
                          },
                          "medications": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 80
                            },
                            "description": "Prescribed medications by name, behind a yes on question 5."
                          },
                          "conditions": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "area": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 40,
                                  "description": "Where: wrist, lower back, knee, or general."
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 3,
                                  "maxLength": 300,
                                  "description": "What it is like, in the client's words."
                                },
                                "since": {
                                  "type": "string",
                                  "format": "date",
                                  "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])))$"
                                },
                                "severity": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 5,
                                  "description": "1 (notices it) to 5 (stops the activity)."
                                },
                                "clinicianCleared": {
                                  "type": "boolean",
                                  "description": "A clinician has seen it and said training around it is fine."
                                }
                              },
                              "required": [
                                "area",
                                "description",
                                "severity",
                                "clinicianCleared"
                              ]
                            },
                            "description": "Injuries, aches and problems with bones, joints or muscles the professional plans around, one entry each, behind a yes on question 6 or on their own."
                          }
                        },
                        "required": [
                          "parq",
                          "diagnoses",
                          "medications",
                          "conditions"
                        ]
                      },
                      "body": {
                        "type": "object",
                        "properties": {
                          "sex": {
                            "type": "string",
                            "enum": [
                              "female",
                              "male",
                              "other"
                            ],
                            "description": "For the norm tables: female, male, or other when neither table fits."
                          },
                          "heightCm": {
                            "type": "number",
                            "minimum": 100,
                            "maximum": 250,
                            "description": "Centimetres."
                          },
                          "weightKg": {
                            "type": "number",
                            "minimum": 30,
                            "maximum": 300,
                            "description": "Kilograms."
                          },
                          "waistCm": {
                            "description": "Centimetres, at the navel.",
                            "type": "number",
                            "minimum": 40,
                            "maximum": 200
                          },
                          "date": {
                            "description": "When the weight and waist were taken.",
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          }
                        },
                        "required": [
                          "sex",
                          "heightCm",
                          "weightKg"
                        ]
                      },
                      "fitness": {
                        "type": "object",
                        "properties": {
                          "experience": {
                            "type": "string",
                            "enum": [
                              "beginner",
                              "intermediate",
                              "advanced",
                              "elite"
                            ],
                            "description": "NSCA training status: beginner (under two months), intermediate, advanced (a year or more), elite (competing)."
                          },
                          "activity": {
                            "type": "object",
                            "properties": {
                              "daysPerWeek": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 7
                              },
                              "minutesPerSession": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 600
                              },
                              "since": {
                                "description": "ISO date this pattern has held since; omitted when it is new.",
                                "type": "string",
                                "format": "date",
                                "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])))$"
                              }
                            },
                            "required": [
                              "daysPerWeek",
                              "minutesPerSession"
                            ],
                            "description": "What the client does now, against ACSM's regular exerciser: 30 minutes or more of moderate activity, three or more days a week, for three months or more."
                          },
                          "strength": {
                            "description": "What the client knows about their strength. Only what they know; nothing is tested for this.",
                            "type": "object",
                            "properties": {
                              "squatKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 500
                              },
                              "benchKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 400
                              },
                              "deadliftKg": {
                                "description": "Best single repetition, kilograms.",
                                "type": "number",
                                "minimum": 0,
                                "maximum": 500
                              },
                              "pushUps": {
                                "description": "Most in one set.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 200
                              },
                              "pullUps": {
                                "description": "Most in one set.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 100
                              }
                            }
                          },
                          "endurance": {
                            "type": "object",
                            "properties": {
                              "fiveKmMinutes": {
                                "description": "Recent 5 km time in minutes, decimals allowed: 22.5 is 22:30.",
                                "type": "number",
                                "minimum": 10,
                                "maximum": 120
                              },
                              "restingHeartRate": {
                                "description": "Beats per minute, at rest in the morning.",
                                "type": "integer",
                                "minimum": 30,
                                "maximum": 120
                              },
                              "notes": {
                                "description": "In the client's words: walks 5 km without stopping, cycles to work.",
                                "type": "string",
                                "maxLength": 300
                              }
                            }
                          },
                          "mobility": {
                            "description": "In the client's words: cannot squat below parallel, tight hips.",
                            "type": "string",
                            "maxLength": 300
                          },
                          "equipment": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "description": "dumbbells to 20 kg, gym, none, bike."
                          },
                          "daysAvailable": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 7,
                            "description": "Days a week the plan may use."
                          },
                          "minutesAvailable": {
                            "type": "integer",
                            "minimum": 10,
                            "maximum": 300,
                            "description": "Minutes per session the plan may use."
                          }
                        },
                        "required": [
                          "experience",
                          "activity",
                          "equipment",
                          "daysAvailable",
                          "minutesAvailable"
                        ]
                      },
                      "diet": {
                        "type": "object",
                        "properties": {
                          "pattern": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 60,
                            "description": "omnivore, pescatarian, vegetarian, vegan, or the client's own word: halal, kosher, low FODMAP by choice."
                          },
                          "allergies": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "food": {
                                  "type": "string",
                                  "minLength": 2,
                                  "maxLength": 60
                                },
                                "clinicianDiagnosed": {
                                  "type": "boolean",
                                  "description": "A clinician has diagnosed it, as against the client's own observation."
                                }
                              },
                              "required": [
                                "food",
                                "clinicianDiagnosed"
                              ]
                            },
                            "description": "Foods that cause a reaction. Avoided in every plan."
                          },
                          "intolerances": {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "description": "Foods the client does not tolerate, in their own experience: stone fruit, lactose."
                          },
                          "dislikes": {
                            "maxItems": 30,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            }
                          },
                          "mealsPerDay": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 8,
                            "description": "Meals on an ordinary day, snacks not counted."
                          },
                          "cookingMinutes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 240,
                            "description": "Minutes the client will cook on an ordinary day."
                          },
                          "cookingSkill": {
                            "type": "string",
                            "enum": [
                              "none",
                              "basic",
                              "confident"
                            ]
                          },
                          "caffeine": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 20,
                            "description": "Cups of coffee, or the equivalent in tea or energy drinks, per day."
                          },
                          "alcohol": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100,
                            "description": "Standard drinks per week: one glass of wine, one bottle of beer, one shot each count as one."
                          },
                          "notes": {
                            "description": "Budget, family meals, shift work, in the client's words.",
                            "type": "string",
                            "maxLength": 500
                          }
                        },
                        "required": [
                          "pattern",
                          "allergies",
                          "intolerances",
                          "dislikes",
                          "mealsPerDay",
                          "cookingMinutes",
                          "cookingSkill",
                          "caffeine",
                          "alcohol"
                        ]
                      },
                      "labs": {
                        "maxItems": 40,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "marker": {
                              "type": "string",
                              "enum": [
                                "total-cholesterol",
                                "ldl",
                                "hdl",
                                "triglycerides",
                                "hba1c",
                                "fasting-glucose",
                                "ferritin",
                                "vitamin-d",
                                "blood-pressure",
                                "resting-heart-rate",
                                "other"
                              ]
                            },
                            "name": {
                              "description": "Named when the marker is other.",
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60
                            },
                            "value": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 20,
                              "description": "As on the lab report: 4.8, or 130/85 for blood pressure."
                            },
                            "unit": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 20,
                              "description": "As on the lab report: mmol/L, mg/dL, mmHg, bpm. Ask when the client gives a number without one; a value without its unit means nothing."
                            },
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "clinicianReviewed": {
                              "type": "boolean",
                              "description": "A clinician took it or has seen it."
                            }
                          },
                          "required": [
                            "marker",
                            "value",
                            "unit",
                            "date",
                            "clinicianReviewed"
                          ]
                        }
                      },
                      "goals": {
                        "minItems": 1,
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string",
                              "minLength": 3,
                              "maxLength": 300,
                              "description": "Specific: what, in the client's words."
                            },
                            "measure": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 100,
                              "description": "Measurable: what is measured. 5 km time, deadlift 1RM, waist, energy on a 1 to 5 scale."
                            },
                            "target": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100,
                              "description": "The target value with its unit: under 30 min, 100 kg, 4 or better most days."
                            },
                            "by": {
                              "type": "string",
                              "format": "date",
                              "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])))$",
                              "description": "Time bound: the date."
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "performance",
                                "wellbeing",
                                "condition"
                              ],
                              "description": "performance (stronger, faster, further), wellbeing (energy, sleep, weight for its own sake), condition (aimed at a disease or an injury; a clinician's, refused here)."
                            }
                          },
                          "required": [
                            "text",
                            "measure",
                            "target",
                            "by",
                            "kind"
                          ]
                        }
                      },
                      "sessions": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "type": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 40,
                              "description": "strength, run, walk, cycle, swim, mobility, or the client's own word."
                            },
                            "minutes": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 600
                            },
                            "rpe": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 10,
                              "description": "Borg CR10, 0 (rest) to 10 (maximal), for the whole session, asked about 30 minutes after it."
                            },
                            "exercises": {
                              "maxItems": 30,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "exercise": {
                                    "type": "string",
                                    "minLength": 2,
                                    "maxLength": 80
                                  },
                                  "sets": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 20
                                  },
                                  "reps": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                  },
                                  "load": {
                                    "description": "In kg, or as the client wrote it: bodyweight, 70%, RPE 8.",
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 30
                                  }
                                },
                                "required": [
                                  "exercise",
                                  "sets",
                                  "reps"
                                ]
                              }
                            },
                            "notes": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "required": [
                            "date",
                            "type",
                            "minutes",
                            "rpe"
                          ]
                        }
                      },
                      "wellbeing": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "sleep": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "Sleep quality last night, 1 (very, very good) to 7 (very, very bad)."
                            },
                            "fatigue": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "1 (very, very low) to 7 (very, very high)."
                            },
                            "stress": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "1 (very, very low) to 7 (very, very high)."
                            },
                            "soreness": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7,
                              "description": "Muscle soreness, 1 (very, very low) to 7 (very, very high)."
                            }
                          },
                          "required": [
                            "date",
                            "sleep",
                            "fatigue",
                            "stress",
                            "soreness"
                          ]
                        }
                      },
                      "food": {
                        "maxItems": 400,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date",
                              "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])))$"
                            },
                            "meals": {
                              "maxItems": 12,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "time": {
                                    "type": "string",
                                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "24 hour clock: 07:30."
                                  },
                                  "items": {
                                    "minItems": 1,
                                    "maxItems": 20,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 2,
                                      "maxLength": 200
                                    },
                                    "description": "In household measures: 2 eggs, 2 slices rye bread, butter, coffee with milk."
                                  },
                                  "context": {
                                    "description": "Before or after training, at a restaurant, in the client's words.",
                                    "type": "string",
                                    "maxLength": 200
                                  }
                                },
                                "required": [
                                  "time",
                                  "items"
                                ]
                              }
                            },
                            "notes": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "required": [
                            "date",
                            "meals"
                          ]
                        }
                      },
                      "notes": {
                        "type": "string",
                        "maxLength": 2000
                      },
                      "plan": {},
                      "question": {
                        "type": "string",
                        "maxLength": 1000
                      }
                    },
                    "required": [
                      "period",
                      "health",
                      "body",
                      "goals",
                      "plan"
                    ]
                  }
                },
                "required": [
                  "professions",
                  "brief"
                ]
              },
              "example": {
                "professions": [
                  "personal-trainer"
                ],
                "brief": {
                  "period": {
                    "from": "2026-10-01",
                    "to": "2026-10-07"
                  },
                  "health": {
                    "parq": {
                      "heartOrBloodPressure": false,
                      "chestPain": false,
                      "dizzinessOrFainting": false,
                      "otherChronicCondition": false,
                      "prescribedMedication": false,
                      "boneJointSoftTissue": false,
                      "supervisedOnly": false,
                      "pregnant": false,
                      "eatingDisorder": false,
                      "declaredOn": "2026-09-20"
                    },
                    "diagnoses": [],
                    "medications": [],
                    "conditions": []
                  },
                  "body": {
                    "sex": "female",
                    "heightCm": 168,
                    "weightKg": 64
                  },
                  "fitness": {
                    "experience": "intermediate",
                    "activity": {
                      "daysPerWeek": 3,
                      "minutesPerSession": 45
                    },
                    "equipment": [
                      "dumbbells to 20 kg"
                    ],
                    "daysAvailable": 3,
                    "minutesAvailable": 60
                  },
                  "diet": {
                    "pattern": "omnivore",
                    "allergies": [],
                    "intolerances": [
                      "stone fruit"
                    ],
                    "dislikes": [],
                    "mealsPerDay": 3,
                    "cookingMinutes": 30,
                    "cookingSkill": "basic",
                    "caffeine": 2,
                    "alcohol": 1
                  },
                  "goals": [
                    {
                      "text": "Run 10 km",
                      "measure": "distance in one run",
                      "target": "10 km",
                      "by": "2026-12-31",
                      "kind": "performance"
                    }
                  ],
                  "notes": "Three days a week, dumbbells at home.",
                  "plan": {
                    "personal-trainer": {
                      "markdown": "# Summary\nThree runs and two dumbbell sessions a week; the wrist stays neutral under load. \n\n# Weeks\n## Week 1\n### Day 1: run\nRPE 3, 30 minutes, easy.\n\n### Day 3: strength\nRPE 7, 45 minutes. Dumbbell row 3 x 10 at 14 kg, rest 90 s. Goblet squat 3 x 10.\n\n# Progression\nAdd five minutes to each run while RPE stays at 3; add one set to the rows in week three.\n\n# Adaptations\nNeutral grip on every press; no push-ups on the palm until the wrist settles.\n\n# Referral\nNone."
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string"
                    },
                    "professions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "assigned",
                        "reviewed",
                        "refused"
                      ]
                    },
                    "screening": {
                      "type": "object",
                      "properties": {
                        "tier": {
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 1
                            },
                            {
                              "type": "number",
                              "const": 2
                            },
                            {
                              "type": "number",
                              "const": 3
                            }
                          ]
                        },
                        "flags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "tier",
                        "flags"
                      ],
                      "additionalProperties": false
                    },
                    "verdict": {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "refused",
                            "clearance"
                          ]
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "ok"
                      ],
                      "additionalProperties": false
                    },
                    "professionalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "review": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "markdown": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "markdown"
                            ],
                            "additionalProperties": false
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "priceCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "EUR"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reviewedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "protocol",
                    "professions",
                    "status",
                    "screening",
                    "verdict",
                    "professionalId",
                    "review",
                    "priceCents",
                    "currency",
                    "createdAt",
                    "claimedAt",
                    "reviewedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/pro/me": {
      "get": {
        "operationId": "professional.me",
        "tags": [
          "professional"
        ],
        "summary": "The signed-in professional.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of a professional>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "location": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string",
                          "pattern": "^[A-Z]{2}$"
                        },
                        "region": {
                          "type": "string",
                          "pattern": "^[A-Z0-9]{1,3}$"
                        }
                      },
                      "required": [
                        "country"
                      ],
                      "additionalProperties": false
                    },
                    "languages": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                      }
                    },
                    "professions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "licensedIn": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "approvedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "employment": {
                      "type": "string",
                      "enum": [
                        "contractor",
                        "employee"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "name",
                    "location",
                    "languages",
                    "professions",
                    "licensedIn",
                    "active",
                    "approvedAt",
                    "employment",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "professional.update",
        "tags": [
          "professional"
        ],
        "summary": "Name, location, languages, professions, credential countries, and the active switch. Professions and location change what the pool shows.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of a professional>.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 100
                  },
                  "location": {
                    "type": "object",
                    "properties": {
                      "country": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$"
                      },
                      "region": {
                        "type": "string",
                        "pattern": "^[A-Z0-9]{1,3}$"
                      }
                    },
                    "required": [
                      "country"
                    ]
                  },
                  "languages": {
                    "minItems": 1,
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                    }
                  },
                  "professions": {
                    "minItems": 1,
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "licensedIn": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Z]{2}$"
                    }
                  },
                  "active": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "languages": [
                  "sv",
                  "en"
                ],
                "active": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "location": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string",
                          "pattern": "^[A-Z]{2}$"
                        },
                        "region": {
                          "type": "string",
                          "pattern": "^[A-Z0-9]{1,3}$"
                        }
                      },
                      "required": [
                        "country"
                      ],
                      "additionalProperties": false
                    },
                    "languages": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                      }
                    },
                    "professions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "licensedIn": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "approvedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "employment": {
                      "type": "string",
                      "enum": [
                        "contractor",
                        "employee"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "name",
                    "location",
                    "languages",
                    "professions",
                    "licensedIn",
                    "active",
                    "approvedAt",
                    "employment",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/pro/pool": {
      "get": {
        "operationId": "professional.pool.list",
        "tags": [
          "professional"
        ],
        "summary": "Orders waiting that this professional may take: every profession named held, active, approved, credentialed where they live, and not reserved for someone else. Oldest first.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of a professional>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "orderId": {
                        "type": "string"
                      },
                      "protocol": {
                        "type": "string"
                      },
                      "professions": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "queued",
                          "assigned",
                          "reviewed",
                          "refused"
                        ]
                      },
                      "screening": {
                        "type": "object",
                        "properties": {
                          "tier": {
                            "anyOf": [
                              {
                                "type": "number",
                                "const": 1
                              },
                              {
                                "type": "number",
                                "const": 2
                              },
                              {
                                "type": "number",
                                "const": 3
                              }
                            ]
                          },
                          "flags": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "tier",
                          "flags"
                        ],
                        "additionalProperties": false
                      },
                      "brief": {},
                      "age": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "language": {
                        "type": "string",
                        "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                      },
                      "payoutCents": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "reservedUntil": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "createdAt": {
                        "type": "string"
                      },
                      "claimedAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "orderId",
                      "protocol",
                      "professions",
                      "status",
                      "screening",
                      "brief",
                      "age",
                      "language",
                      "payoutCents",
                      "reservedUntil",
                      "createdAt",
                      "claimedAt"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/pro/pool/{id}/claim": {
      "post": {
        "operationId": "professional.pool.claim",
        "tags": [
          "professional"
        ],
        "summary": "Takes an order from the pool. The first claim wins; a second answers that it is taken.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of a professional>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string"
                    },
                    "professions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "assigned",
                        "reviewed",
                        "refused"
                      ]
                    },
                    "screening": {
                      "type": "object",
                      "properties": {
                        "tier": {
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 1
                            },
                            {
                              "type": "number",
                              "const": 2
                            },
                            {
                              "type": "number",
                              "const": 3
                            }
                          ]
                        },
                        "flags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "tier",
                        "flags"
                      ],
                      "additionalProperties": false
                    },
                    "brief": {},
                    "age": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "language": {
                      "type": "string",
                      "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                    },
                    "payoutCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "reservedUntil": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "orderId",
                    "protocol",
                    "professions",
                    "status",
                    "screening",
                    "brief",
                    "age",
                    "language",
                    "payoutCents",
                    "reservedUntil",
                    "createdAt",
                    "claimedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/pro/work": {
      "get": {
        "operationId": "professional.work.list",
        "tags": [
          "professional"
        ],
        "summary": "The orders this professional has claimed and not yet submitted, oldest first.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of a professional>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "orderId": {
                        "type": "string"
                      },
                      "protocol": {
                        "type": "string"
                      },
                      "professions": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "queued",
                          "assigned",
                          "reviewed",
                          "refused"
                        ]
                      },
                      "screening": {
                        "type": "object",
                        "properties": {
                          "tier": {
                            "anyOf": [
                              {
                                "type": "number",
                                "const": 1
                              },
                              {
                                "type": "number",
                                "const": 2
                              },
                              {
                                "type": "number",
                                "const": 3
                              }
                            ]
                          },
                          "flags": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "tier",
                          "flags"
                        ],
                        "additionalProperties": false
                      },
                      "brief": {},
                      "age": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "language": {
                        "type": "string",
                        "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                      },
                      "payoutCents": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "reservedUntil": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "createdAt": {
                        "type": "string"
                      },
                      "claimedAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "orderId",
                      "protocol",
                      "professions",
                      "status",
                      "screening",
                      "brief",
                      "age",
                      "language",
                      "payoutCents",
                      "reservedUntil",
                      "createdAt",
                      "claimedAt"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/pro/work/{id}": {
      "get": {
        "operationId": "professional.work.get",
        "tags": [
          "professional"
        ],
        "summary": "One claimed order: the brief whole, the screening, an age and a language.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of a professional>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string"
                    },
                    "professions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "assigned",
                        "reviewed",
                        "refused"
                      ]
                    },
                    "screening": {
                      "type": "object",
                      "properties": {
                        "tier": {
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 1
                            },
                            {
                              "type": "number",
                              "const": 2
                            },
                            {
                              "type": "number",
                              "const": 3
                            }
                          ]
                        },
                        "flags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "tier",
                        "flags"
                      ],
                      "additionalProperties": false
                    },
                    "brief": {},
                    "age": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "language": {
                      "type": "string",
                      "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                    },
                    "payoutCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "reservedUntil": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "orderId",
                    "protocol",
                    "professions",
                    "status",
                    "screening",
                    "brief",
                    "age",
                    "language",
                    "payoutCents",
                    "reservedUntil",
                    "createdAt",
                    "claimedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/pro/work/{id}/release": {
      "post": {
        "operationId": "professional.work.release",
        "tags": [
          "professional"
        ],
        "summary": "Puts a claimed order back in the pool. The draft is kept for whoever claims it next; the release is counted.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of a professional>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/pro/work/{id}/draft": {
      "get": {
        "operationId": "professional.work.draft.get",
        "tags": [
          "professional"
        ],
        "summary": "The draft so far, one markdown per profession, and the headings each part must carry.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of a professional>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "parts": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "markdown": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "markdown"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "templates": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "standard": {
                            "type": "string"
                          },
                          "sections": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "heading": {
                                  "type": "string"
                                },
                                "required": {
                                  "type": "boolean"
                                },
                                "hint": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "heading",
                                "required",
                                "hint"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "standard",
                          "sections"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "parts",
                    "templates"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "professional.work.draft.save",
        "tags": [
          "professional"
        ],
        "summary": "Saves one part of the draft. Nothing is checked; the draft is the professional's own.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of a professional>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "profession": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Which part: the profession's key."
                  },
                  "markdown": {
                    "type": "string",
                    "maxLength": 30000
                  }
                },
                "required": [
                  "profession",
                  "markdown"
                ]
              },
              "example": {
                "profession": "personal-trainer",
                "markdown": "# Summary\nThree runs and two dumbbell sessions a week; the wrist stays neutral under load. \n\n# Weeks\n## Week 1\n### Day 1: run\nRPE 3, 30 minutes, easy.\n\n### Day 3: strength\nRPE 7, 45 minutes. Dumbbell row 3 x 10 at 14 kg, rest 90 s. Goblet squat 3 x 10.\n\n# Progression\nAdd five minutes to each run while RPE stays at 3; add one set to the rows in week three.\n\n# Adaptations\nNeutral grip on every press; no push-ups on the palm until the wrist settles.\n\n# Referral\nNone."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/pro/work/{id}/validate": {
      "post": {
        "operationId": "professional.work.part.validate",
        "tags": [
          "professional"
        ],
        "summary": "Checks one part against its standard's headings and the review rules, and answers every finding with where it is. Changes nothing.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of a professional>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "profession": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Which part: the profession's key."
                  },
                  "markdown": {
                    "type": "string",
                    "maxLength": 30000
                  }
                },
                "required": [
                  "profession",
                  "markdown"
                ]
              },
              "example": {
                "profession": "personal-trainer",
                "markdown": "# Summary\nThree runs and two dumbbell sessions a week; the wrist stays neutral under load. \n\n# Weeks\n## Week 1\n### Day 1: run\nRPE 3, 30 minutes, easy.\n\n### Day 3: strength\nRPE 7, 45 minutes. Dumbbell row 3 x 10 at 14 kg, rest 90 s. Goblet squat 3 x 10.\n\n# Progression\nAdd five minutes to each run while RPE stays at 3; add one set to the rows in week three.\n\n# Adaptations\nNeutral grip on every press; no push-ups on the palm until the wrist settles.\n\n# Referral\nNone."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "issues": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": {
                            "type": "string"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "path",
                          "message"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "ok",
                    "issues"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/pro/work/{id}/submit": {
      "post": {
        "operationId": "professional.work.submit",
        "tags": [
          "professional"
        ],
        "summary": "Submits the review, one part per profession the order names. Every part is checked; a finding refuses the whole and nothing is delivered. Delivered, the pot is charged, the earning is booked and the client is told.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of a professional>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "review": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "markdown": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "markdown"
                      ]
                    }
                  }
                },
                "required": [
                  "review"
                ]
              },
              "example": {
                "review": {
                  "personal-trainer": {
                    "markdown": "# Summary\nThree runs and two dumbbell sessions a week; the wrist stays neutral under load. \n\n# Weeks\n## Week 1\n### Day 1: run\nRPE 3, 30 minutes, easy.\n\n### Day 3: strength\nRPE 7, 45 minutes. Dumbbell row 3 x 10 at 14 kg, rest 90 s. Goblet squat 3 x 10.\n\n# Progression\nAdd five minutes to each run while RPE stays at 3; add one set to the rows in week three.\n\n# Adaptations\nNeutral grip on every press; no push-ups on the palm until the wrist settles.\n\n# Referral\nNone."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "const": "reviewed"
                    },
                    "reviewedAt": {
                      "type": "string"
                    },
                    "earnedCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "orderId",
                    "status",
                    "reviewedAt",
                    "earnedCents"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/pro/earnings": {
      "get": {
        "operationId": "professional.earnings.list",
        "tags": [
          "professional"
        ],
        "summary": "Every earning and what is owed, not yet invoiced. An employee has none and is answered 403.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of a professional>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "owedCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "earnings": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "orderId": {
                            "type": "string"
                          },
                          "amountCents": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "description": {
                            "type": "string"
                          },
                          "payoutId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "orderId",
                          "amountCents",
                          "description",
                          "payoutId",
                          "at"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "owedCents",
                    "earnings"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/pro/payouts": {
      "get": {
        "operationId": "professional.payouts.list",
        "tags": [
          "professional"
        ],
        "summary": "The invoices to us, and whether each is paid. An employee has none and is answered 403.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of a professional>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "amountCents": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "invoiceNumber": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "invoiced",
                          "paid"
                        ]
                      },
                      "at": {
                        "type": "string"
                      },
                      "paidAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "amountCents",
                      "invoiceNumber",
                      "status",
                      "at",
                      "paidAt"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "professional.payouts.request",
        "tags": [
          "professional"
        ],
        "summary": "Invoices us for everything owed. The earnings move onto the payout; nothing owed answers that nothing is. An employee is answered 403.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <session of a professional>.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "invoiceNumber": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60,
                    "description": "The professional's own invoice number."
                  }
                },
                "required": [
                  "invoiceNumber"
                ]
              },
              "example": {
                "invoiceNumber": "VERA-2026-014"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "amountCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "invoiceNumber": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "invoiced",
                        "paid"
                      ]
                    },
                    "at": {
                      "type": "string"
                    },
                    "paidAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "earnings": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "id",
                    "amountCents",
                    "invoiceNumber",
                    "status",
                    "at",
                    "paidAt",
                    "earnings"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/operator/credit": {
      "post": {
        "operationId": "operator.credit",
        "tags": [
          "operator"
        ],
        "summary": "Credits a pot by hand, in the payer's currency, with a reference to the invoice or the reason. Not a sale: it is outside the tax export.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <operator token>.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "payer": {
                    "type": "string",
                    "enum": [
                      "client",
                      "organisation"
                    ]
                  },
                  "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)$"
                  },
                  "amountCents": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "ref": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  }
                },
                "required": [
                  "payer",
                  "id",
                  "amountCents",
                  "ref"
                ]
              },
              "example": {
                "payer": "client",
                "id": "7d1f0a0e-2c4b-4c7e-9a6e-000000000001",
                "amountCents": 2000,
                "ref": "INV-2026-001"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "amountCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "ref": {
                      "type": "string"
                    },
                    "at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "amountCents",
                    "ref",
                    "at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/operator/tax": {
      "get": {
        "operationId": "operator.tax.export",
        "tags": [
          "operator"
        ],
        "summary": "Every deposit paid from one date up to and including another, one line per receipt with net, VAT and total, a summary per currency and basis, and the same as CSV for the bookkeeping.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <operator token>.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date",
              "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])))$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date",
              "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])))$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "receiptNumber": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "paidOn": {
                            "type": "string",
                            "format": "date",
                            "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])))$"
                          },
                          "ref": {
                            "type": "string"
                          },
                          "payer": {
                            "type": "string",
                            "enum": [
                              "client",
                              "organisation"
                            ]
                          },
                          "country": {
                            "type": "string"
                          },
                          "vatNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "currency": {
                            "type": "string",
                            "enum": [
                              "USD",
                              "EUR"
                            ]
                          },
                          "netCents": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "vatPercent": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "vatCents": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "grossCents": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "basis": {
                            "type": "string",
                            "enum": [
                              "domestic",
                              "eu-consumer",
                              "reverse-charge",
                              "outside-eu"
                            ]
                          }
                        },
                        "required": [
                          "receiptNumber",
                          "paidOn",
                          "ref",
                          "payer",
                          "country",
                          "vatNumber",
                          "currency",
                          "netCents",
                          "vatPercent",
                          "vatCents",
                          "grossCents",
                          "basis"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "summary": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "currency": {
                            "type": "string",
                            "enum": [
                              "USD",
                              "EUR"
                            ]
                          },
                          "basis": {
                            "type": "string",
                            "enum": [
                              "domestic",
                              "eu-consumer",
                              "reverse-charge",
                              "outside-eu"
                            ]
                          },
                          "vatPercent": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "count": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "netCents": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "vatCents": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "grossCents": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "currency",
                          "basis",
                          "vatPercent",
                          "count",
                          "netCents",
                          "vatCents",
                          "grossCents"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "csv": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "lines",
                    "summary",
                    "csv"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/operator/payouts/{id}/paid": {
      "post": {
        "operationId": "operator.payouts.markPaid",
        "tags": [
          "operator"
        ],
        "summary": "We have paid the professional's invoice.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <operator token>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "amountCents": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "invoiceNumber": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "invoiced",
                        "paid"
                      ]
                    },
                    "at": {
                      "type": "string"
                    },
                    "paidAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "amountCents",
                    "invoiceNumber",
                    "status",
                    "at",
                    "paidAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/operator/professionals": {
      "get": {
        "operationId": "operator.professionals.list",
        "tags": [
          "operator"
        ],
        "summary": "Every professional, approved or waiting.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <operator token>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "location": {
                        "type": "object",
                        "properties": {
                          "country": {
                            "type": "string",
                            "pattern": "^[A-Z]{2}$"
                          },
                          "region": {
                            "type": "string",
                            "pattern": "^[A-Z0-9]{1,3}$"
                          }
                        },
                        "required": [
                          "country"
                        ],
                        "additionalProperties": false
                      },
                      "languages": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                        }
                      },
                      "professions": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "licensedIn": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "active": {
                        "type": "boolean"
                      },
                      "approvedAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "employment": {
                        "type": "string",
                        "enum": [
                          "contractor",
                          "employee"
                        ]
                      },
                      "createdAt": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "email",
                      "name",
                      "location",
                      "languages",
                      "professions",
                      "licensedIn",
                      "active",
                      "approvedAt",
                      "employment",
                      "createdAt"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/operator/professionals/{id}/approve": {
      "post": {
        "operationId": "operator.professionals.approve",
        "tags": [
          "operator"
        ],
        "summary": "Opens the pool to a professional we have vetted, as a contractor who earns per document or an employee on salary who earns nothing here. Approving again changes the engagement.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <operator token>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "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)$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "employment": {
                    "default": "contractor",
                    "type": "string",
                    "enum": [
                      "contractor",
                      "employee"
                    ]
                  }
                }
              },
              "example": {
                "employment": "contractor"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "location": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string",
                          "pattern": "^[A-Z]{2}$"
                        },
                        "region": {
                          "type": "string",
                          "pattern": "^[A-Z0-9]{1,3}$"
                        }
                      },
                      "required": [
                        "country"
                      ],
                      "additionalProperties": false
                    },
                    "languages": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                      }
                    },
                    "professions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "licensedIn": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "approvedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "employment": {
                      "type": "string",
                      "enum": [
                        "contractor",
                        "employee"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "name",
                    "location",
                    "languages",
                    "professions",
                    "licensedIn",
                    "active",
                    "approvedAt",
                    "employment",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/operator/organisations": {
      "get": {
        "operationId": "operator.organisations.list",
        "tags": [
          "operator"
        ],
        "summary": "Every organisation.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <operator token>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string"
                      },
                      "vatNumber": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "currency": {
                        "type": "string",
                        "enum": [
                          "USD",
                          "EUR"
                        ]
                      },
                      "createdAt": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "email",
                      "country",
                      "vatNumber",
                      "currency",
                      "createdAt"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/operator/orders": {
      "get": {
        "operationId": "operator.orders.list",
        "tags": [
          "operator"
        ],
        "summary": "Every order by status, with money and who has it, never the brief or the review.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <operator token>.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "assigned",
                "reviewed",
                "refused"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "protocol": {
                        "type": "string"
                      },
                      "professions": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "queued",
                          "assigned",
                          "reviewed",
                          "refused"
                        ]
                      },
                      "professionalId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "priceCents": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "currency": {
                        "type": "string",
                        "enum": [
                          "USD",
                          "EUR"
                        ]
                      },
                      "createdAt": {
                        "type": "string"
                      },
                      "claimedAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "reviewedAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "clientId": {
                        "type": "string"
                      },
                      "clientRef": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "protocol",
                      "professions",
                      "status",
                      "professionalId",
                      "priceCents",
                      "currency",
                      "createdAt",
                      "claimedAt",
                      "reviewedAt",
                      "clientId",
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/operator/health": {
      "get": {
        "operationId": "operator.health",
        "tags": [
          "operator"
        ],
        "summary": "Counts: clients, professionals, organisations, orders by status, webhook deliveries waiting.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <operator token>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/operator/noop": {
      "post": {
        "operationId": "operator.noop",
        "tags": [
          "operator"
        ],
        "summary": "Does nothing. Proves the token.",
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Authorization: Bearer <operator token>.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "A refusal that says why and whose fault it is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}