{
  "components": {
    "schemas": {
      "AI": {
        "additionalProperties": false,
        "properties": {
          "attachments": {
            "items": {
              "$ref": "#/components/schemas/AttachmentReading"
            },
            "type": "array"
          },
          "category": {
            "$ref": "#/components/schemas/TicketCategory"
          },
          "identity_review": {
            "type": "boolean"
          },
          "medications": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "patient": {
            "$ref": "#/components/schemas/PersonValues",
            "description": "Whom the text names (first and last name, birth date), as the patient match reads it"
          },
          "priority": {
            "$ref": "#/components/schemas/TicketPriority"
          },
          "requests": {
            "items": {
              "$ref": "#/components/schemas/Request"
            },
            "type": "array"
          },
          "revision": {
            "format": "int64",
            "type": "integer"
          },
          "summary": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "identity_review",
          "revision",
          "requests",
          "attachments",
          "title",
          "summary",
          "category",
          "priority"
        ],
        "type": "object"
      },
      "Accepted": {
        "additionalProperties": false,
        "properties": {
          "at": {
            "description": "When it was ticked: the form's sending, else the run's start",
            "format": "date-time",
            "type": "string"
          },
          "field": {
            "type": "string"
          },
          "how": {
            "enum": [
              "patient",
              "staff",
              "phone",
              "agent",
              "api"
            ],
            "type": "string"
          },
          "link": {
            "type": "string"
          },
          "member": {
            "description": "The member who entered it (the desk) or started the run",
            "type": "string"
          },
          "shown": {
            "type": "string"
          },
          "words": {
            "type": "string"
          }
        },
        "required": [
          "field",
          "shown",
          "words",
          "how",
          "at"
        ],
        "type": "object"
      },
      "ActionInfo": {
        "additionalProperties": false,
        "properties": {
          "input": {
            "additionalProperties": {},
            "description": "JSON Schema of the action's input",
            "type": "object"
          },
          "name": {
            "type": "string"
          },
          "option": {
            "additionalProperties": {},
            "description": "JSON Schema of an option's value, for actions whose options all have one shape",
            "type": "object"
          }
        },
        "required": [
          "name",
          "input"
        ],
        "type": "object"
      },
      "ActionRun": {
        "oneOf": [
          {
            "additionalProperties": false,
            "properties": {
              "action": {
                "enum": [
                  "book_appointment"
                ],
                "type": "string"
              },
              "approved_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "approved_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "checks": {
                "items": {
                  "$ref": "#/components/schemas/Check"
                },
                "type": "array"
              },
              "created_at": {
                "format": "date-time",
                "type": "string"
              },
              "created_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "form_effect": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "form_seq": {
                "format": "int64",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "form_version": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "identified_by": {
                "type": "string"
              },
              "input": {
                "additionalProperties": false,
                "properties": {
                  "by_hand": {
                    "description": "The contact details staff typed in: sent instead of the patient's record. Set by staff's edits in the app; an agent's or Ilka's marks none",
                    "items": {
                      "enum": [
                        "first_name",
                        "last_name",
                        "birth_date",
                        "phone",
                        "email"
                      ],
                      "type": "string"
                    },
                    "maxItems": 5,
                    "type": "array"
                  },
                  "calendar_id": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "contact": {
                    "additionalProperties": false,
                    "properties": {
                      "birthdate": {
                        "format": "date",
                        "type": "string"
                      },
                      "email": {
                        "maxLength": 254,
                        "type": "string"
                      },
                      "first_name": {
                        "description": "With guest \"first last\": the first name, so a surname of several words stays whole",
                        "maxLength": 100,
                        "type": "string"
                      },
                      "last_name": {
                        "maxLength": 100,
                        "type": "string"
                      },
                      "phone": {
                        "maxLength": 40,
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "doctor": {
                    "description": "The calendar's name, filled in from the slot for staff",
                    "type": "string"
                  },
                  "follow_ups": {
                    "description": "Appointments booked together with this one, each in a window of days after it",
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "calendar_id": {
                          "minLength": 1,
                          "type": "string"
                        },
                        "doctor": {
                          "type": "string"
                        },
                        "hold": {
                          "type": "string"
                        },
                        "max_days": {
                          "description": "At the latest this many calendar days after the appointment",
                          "format": "int64",
                          "minimum": 0,
                          "type": "integer"
                        },
                        "min_days": {
                          "description": "At the earliest this many calendar days after the appointment",
                          "format": "int64",
                          "minimum": 0,
                          "type": "integer"
                        },
                        "questionnaire": {
                          "items": {
                            "additionalProperties": false,
                            "properties": {
                              "field": {
                                "minLength": 1,
                                "type": "string"
                              },
                              "label": {
                                "maxLength": 2000,
                                "type": "string"
                              },
                              "type": {
                                "enum": [
                                  "textfield",
                                  "textfield_mandatory",
                                  "checkbox",
                                  "checkbox_mandatory",
                                  "single_selection",
                                  "multi_selection"
                                ],
                                "type": "string"
                              },
                              "value": {
                                "maxLength": 2000,
                                "minLength": 1,
                                "type": "string"
                              }
                            },
                            "required": [
                              "field",
                              "value"
                            ],
                            "type": "object"
                          },
                          "maxItems": 50,
                          "type": "array"
                        },
                        "reason": {
                          "type": "string"
                        },
                        "reason_id": {
                          "minLength": 1,
                          "type": "string"
                        },
                        "start": {
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "required": [
                        "calendar_id",
                        "start",
                        "reason_id"
                      ],
                      "type": "object"
                    },
                    "maxItems": 3,
                    "type": "array"
                  },
                  "guest": {
                    "description": "Who comes when the ticket names no patient (built-in calendar, samedi or x.webtermin): their name; defaults to the ticket's contact",
                    "maxLength": 200,
                    "type": "string"
                  },
                  "hold": {
                    "type": "string"
                  },
                  "questionnaire": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "field": {
                          "minLength": 1,
                          "type": "string"
                        },
                        "label": {
                          "maxLength": 2000,
                          "type": "string"
                        },
                        "type": {
                          "enum": [
                            "textfield",
                            "textfield_mandatory",
                            "checkbox",
                            "checkbox_mandatory",
                            "single_selection",
                            "multi_selection"
                          ],
                          "type": "string"
                        },
                        "value": {
                          "maxLength": 2000,
                          "minLength": 1,
                          "type": "string"
                        }
                      },
                      "required": [
                        "field",
                        "value"
                      ],
                      "type": "object"
                    },
                    "maxItems": 50,
                    "type": "array"
                  },
                  "reason": {
                    "description": "The visit reason's name, filled in from the slot for staff",
                    "type": "string"
                  },
                  "reason_id": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "start": {
                    "format": "date-time",
                    "type": "string"
                  }
                },
                "required": [
                  "calendar_id",
                  "start",
                  "reason_id"
                ],
                "type": "object"
              },
              "input_revision": {
                "format": "int64",
                "type": "integer"
              },
              "location_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "operation_id": {
                "type": "string"
              },
              "patient_ref": {
                "type": "string"
              },
              "policy_reason": {
                "type": "string"
              },
              "policy_version": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "practice_id": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              },
              "result": {
                "additionalProperties": false,
                "properties": {
                  "accepted": {
                    "items": {
                      "$ref": "#/components/schemas/Accepted"
                    },
                    "type": "array"
                  },
                  "calendar": {
                    "enum": [
                      "pvs",
                      "demo",
                      "atmos",
                      "samedi",
                      "webtermin",
                      "doctolib",
                      "patmed",
                      "terminico"
                    ],
                    "type": "string"
                  },
                  "error": {
                    "enum": [
                      "checks_failed",
                      "pvs_timeout",
                      "pvs_unavailable",
                      "pvs_error",
                      "calendar_login_refused",
                      "patient_data_missing",
                      "policy_off",
                      "computer_offline",
                      "agent_failed"
                    ],
                    "type": "string"
                  },
                  "items": {
                    "items": {
                      "$ref": "#/components/schemas/Item"
                    },
                    "type": "array"
                  },
                  "sent": {
                    "items": {
                      "$ref": "#/components/schemas/SentDetail"
                    },
                    "type": "array"
                  }
                },
                "type": [
                  "object",
                  "null"
                ]
              },
              "source": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "ticket_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "updated_at": {
                "format": "date-time",
                "type": "string"
              }
            },
            "required": [
              "id",
              "practice_id",
              "ticket_id",
              "action",
              "patient_ref",
              "source",
              "input",
              "input_revision",
              "request_id",
              "status",
              "policy_version",
              "form_version",
              "policy_reason",
              "checks",
              "result",
              "operation_id",
              "created_by",
              "approved_by",
              "approved_at",
              "created_at",
              "updated_at",
              "location_id",
              "form_seq",
              "form_effect",
              "identified_by"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "action": {
                "enum": [
                  "cancel_appointment"
                ],
                "type": "string"
              },
              "approved_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "approved_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "checks": {
                "items": {
                  "$ref": "#/components/schemas/Check"
                },
                "type": "array"
              },
              "created_at": {
                "format": "date-time",
                "type": "string"
              },
              "created_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "form_effect": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "form_seq": {
                "format": "int64",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "form_version": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "identified_by": {
                "type": "string"
              },
              "input": {
                "additionalProperties": false,
                "properties": {
                  "appointment": {
                    "description": "The calendar's id of the appointment, where the portal asked; the checks go by calendar and start",
                    "type": "string"
                  },
                  "booking": {
                    "description": "For a guest: the booking run (book_appointment) of the appointment",
                    "type": "string"
                  },
                  "calendar_id": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "contact": {
                    "additionalProperties": false,
                    "properties": {
                      "birthdate": {
                        "format": "date",
                        "type": "string"
                      },
                      "email": {
                        "maxLength": 254,
                        "type": "string"
                      },
                      "first_name": {
                        "description": "With guest \"first last\": the first name, so a surname of several words stays whole",
                        "maxLength": 100,
                        "type": "string"
                      },
                      "last_name": {
                        "maxLength": 100,
                        "type": "string"
                      },
                      "phone": {
                        "maxLength": 40,
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "doctor": {
                    "description": "Whom the appointment is with, else what for (Appointment), filled in from the appointment for staff",
                    "type": "string"
                  },
                  "reason": {
                    "description": "Why the patient cancels",
                    "type": "string"
                  },
                  "reason_id": {
                    "description": "The appointment's visit reason, as the practice system names it",
                    "type": "string"
                  },
                  "start": {
                    "format": "date-time",
                    "type": "string"
                  }
                },
                "required": [
                  "calendar_id",
                  "start"
                ],
                "type": "object"
              },
              "input_revision": {
                "format": "int64",
                "type": "integer"
              },
              "location_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "operation_id": {
                "type": "string"
              },
              "patient_ref": {
                "type": "string"
              },
              "policy_reason": {
                "type": "string"
              },
              "policy_version": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "practice_id": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              },
              "result": {
                "additionalProperties": false,
                "properties": {
                  "accepted": {
                    "items": {
                      "$ref": "#/components/schemas/Accepted"
                    },
                    "type": "array"
                  },
                  "calendar": {
                    "enum": [
                      "pvs",
                      "demo",
                      "atmos",
                      "samedi",
                      "webtermin",
                      "doctolib",
                      "patmed",
                      "terminico"
                    ],
                    "type": "string"
                  },
                  "error": {
                    "enum": [
                      "checks_failed",
                      "pvs_timeout",
                      "pvs_unavailable",
                      "pvs_error",
                      "calendar_login_refused",
                      "patient_data_missing",
                      "policy_off",
                      "computer_offline",
                      "agent_failed"
                    ],
                    "type": "string"
                  },
                  "items": {
                    "items": {
                      "$ref": "#/components/schemas/Item"
                    },
                    "type": "array"
                  },
                  "sent": {
                    "items": {
                      "$ref": "#/components/schemas/SentDetail"
                    },
                    "type": "array"
                  }
                },
                "type": [
                  "object",
                  "null"
                ]
              },
              "source": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "ticket_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "updated_at": {
                "format": "date-time",
                "type": "string"
              }
            },
            "required": [
              "id",
              "practice_id",
              "ticket_id",
              "action",
              "patient_ref",
              "source",
              "input",
              "input_revision",
              "request_id",
              "status",
              "policy_version",
              "form_version",
              "policy_reason",
              "checks",
              "result",
              "operation_id",
              "created_by",
              "approved_by",
              "approved_at",
              "created_at",
              "updated_at",
              "location_id",
              "form_seq",
              "form_effect",
              "identified_by"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "action": {
                "enum": [
                  "file_document"
                ],
                "type": "string"
              },
              "approved_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "approved_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "checks": {
                "items": {
                  "$ref": "#/components/schemas/Check"
                },
                "type": "array"
              },
              "created_at": {
                "format": "date-time",
                "type": "string"
              },
              "created_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "form_effect": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "form_seq": {
                "format": "int64",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "form_version": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "identified_by": {
                "type": "string"
              },
              "input": {
                "additionalProperties": false,
                "properties": {
                  "file_id": {
                    "description": "An attachment of the ticket (shape files) to file into the patient's record",
                    "type": "string"
                  },
                  "title": {
                    "description": "What staff read in the record, at the start of the file name; defaults to the file's name without its extension",
                    "maxLength": 80,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "file_id",
                  "title"
                ],
                "type": "object"
              },
              "input_revision": {
                "format": "int64",
                "type": "integer"
              },
              "location_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "operation_id": {
                "type": "string"
              },
              "patient_ref": {
                "type": "string"
              },
              "policy_reason": {
                "type": "string"
              },
              "policy_version": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "practice_id": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              },
              "result": {
                "additionalProperties": false,
                "properties": {
                  "accepted": {
                    "items": {
                      "$ref": "#/components/schemas/Accepted"
                    },
                    "type": "array"
                  },
                  "calendar": {
                    "enum": [
                      "pvs",
                      "demo",
                      "atmos",
                      "samedi",
                      "webtermin",
                      "doctolib",
                      "patmed",
                      "terminico"
                    ],
                    "type": "string"
                  },
                  "error": {
                    "enum": [
                      "checks_failed",
                      "pvs_timeout",
                      "pvs_unavailable",
                      "pvs_error",
                      "calendar_login_refused",
                      "patient_data_missing",
                      "policy_off",
                      "computer_offline",
                      "agent_failed"
                    ],
                    "type": "string"
                  },
                  "items": {
                    "items": {
                      "$ref": "#/components/schemas/Item"
                    },
                    "type": "array"
                  },
                  "sent": {
                    "items": {
                      "$ref": "#/components/schemas/SentDetail"
                    },
                    "type": "array"
                  }
                },
                "type": [
                  "object",
                  "null"
                ]
              },
              "source": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "ticket_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "updated_at": {
                "format": "date-time",
                "type": "string"
              }
            },
            "required": [
              "id",
              "practice_id",
              "ticket_id",
              "action",
              "patient_ref",
              "source",
              "input",
              "input_revision",
              "request_id",
              "status",
              "policy_version",
              "form_version",
              "policy_reason",
              "checks",
              "result",
              "operation_id",
              "created_by",
              "approved_by",
              "approved_at",
              "created_at",
              "updated_at",
              "location_id",
              "form_seq",
              "form_effect",
              "identified_by"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "action": {
                "enum": [
                  "order_freetext_medication"
                ],
                "type": "string"
              },
              "approved_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "approved_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "checks": {
                "items": {
                  "$ref": "#/components/schemas/Check"
                },
                "type": "array"
              },
              "created_at": {
                "format": "date-time",
                "type": "string"
              },
              "created_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "form_effect": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "form_seq": {
                "format": "int64",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "form_version": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "identified_by": {
                "type": "string"
              },
              "input": {
                "additionalProperties": false,
                "properties": {
                  "text": {
                    "description": "The medication as the patient names it, e.g. not on the plan",
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "type": "object"
              },
              "input_revision": {
                "format": "int64",
                "type": "integer"
              },
              "location_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "operation_id": {
                "type": "string"
              },
              "patient_ref": {
                "type": "string"
              },
              "policy_reason": {
                "type": "string"
              },
              "policy_version": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "practice_id": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              },
              "result": {
                "additionalProperties": false,
                "properties": {
                  "accepted": {
                    "items": {
                      "$ref": "#/components/schemas/Accepted"
                    },
                    "type": "array"
                  },
                  "calendar": {
                    "enum": [
                      "pvs",
                      "demo",
                      "atmos",
                      "samedi",
                      "webtermin",
                      "doctolib",
                      "patmed",
                      "terminico"
                    ],
                    "type": "string"
                  },
                  "error": {
                    "enum": [
                      "checks_failed",
                      "pvs_timeout",
                      "pvs_unavailable",
                      "pvs_error",
                      "calendar_login_refused",
                      "patient_data_missing",
                      "policy_off",
                      "computer_offline",
                      "agent_failed"
                    ],
                    "type": "string"
                  },
                  "items": {
                    "items": {
                      "$ref": "#/components/schemas/Item"
                    },
                    "type": "array"
                  },
                  "sent": {
                    "items": {
                      "$ref": "#/components/schemas/SentDetail"
                    },
                    "type": "array"
                  }
                },
                "type": [
                  "object",
                  "null"
                ]
              },
              "source": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "ticket_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "updated_at": {
                "format": "date-time",
                "type": "string"
              }
            },
            "required": [
              "id",
              "practice_id",
              "ticket_id",
              "action",
              "patient_ref",
              "source",
              "input",
              "input_revision",
              "request_id",
              "status",
              "policy_version",
              "form_version",
              "policy_reason",
              "checks",
              "result",
              "operation_id",
              "created_by",
              "approved_by",
              "approved_at",
              "created_at",
              "updated_at",
              "location_id",
              "form_seq",
              "form_effect",
              "identified_by"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "action": {
                "enum": [
                  "order_medication"
                ],
                "type": "string"
              },
              "approved_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "approved_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "checks": {
                "items": {
                  "$ref": "#/components/schemas/Check"
                },
                "type": "array"
              },
              "created_at": {
                "format": "date-time",
                "type": "string"
              },
              "created_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "form_effect": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "form_seq": {
                "format": "int64",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "form_version": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "identified_by": {
                "type": "string"
              },
              "input": {
                "additionalProperties": false,
                "properties": {
                  "items": {
                    "description": "Entries of the patient's plan; the cap only guards the API, a plan never has as many",
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "pzn": {
                          "pattern": "^[0-9]{8}$",
                          "type": "string"
                        }
                      },
                      "required": [
                        "pzn"
                      ],
                      "type": "object"
                    },
                    "maxItems": 200,
                    "minItems": 1,
                    "type": "array"
                  },
                  "pickup": {
                    "enum": [
                      "practice",
                      "pharmacy",
                      "erezept"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "items"
                ],
                "type": "object"
              },
              "input_revision": {
                "format": "int64",
                "type": "integer"
              },
              "location_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "operation_id": {
                "type": "string"
              },
              "patient_ref": {
                "type": "string"
              },
              "policy_reason": {
                "type": "string"
              },
              "policy_version": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "practice_id": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              },
              "result": {
                "additionalProperties": false,
                "properties": {
                  "accepted": {
                    "items": {
                      "$ref": "#/components/schemas/Accepted"
                    },
                    "type": "array"
                  },
                  "calendar": {
                    "enum": [
                      "pvs",
                      "demo",
                      "atmos",
                      "samedi",
                      "webtermin",
                      "doctolib",
                      "patmed",
                      "terminico"
                    ],
                    "type": "string"
                  },
                  "error": {
                    "enum": [
                      "checks_failed",
                      "pvs_timeout",
                      "pvs_unavailable",
                      "pvs_error",
                      "calendar_login_refused",
                      "patient_data_missing",
                      "policy_off",
                      "computer_offline",
                      "agent_failed"
                    ],
                    "type": "string"
                  },
                  "items": {
                    "items": {
                      "$ref": "#/components/schemas/Item"
                    },
                    "type": "array"
                  },
                  "sent": {
                    "items": {
                      "$ref": "#/components/schemas/SentDetail"
                    },
                    "type": "array"
                  }
                },
                "type": [
                  "object",
                  "null"
                ]
              },
              "source": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "ticket_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "updated_at": {
                "format": "date-time",
                "type": "string"
              }
            },
            "required": [
              "id",
              "practice_id",
              "ticket_id",
              "action",
              "patient_ref",
              "source",
              "input",
              "input_revision",
              "request_id",
              "status",
              "policy_version",
              "form_version",
              "policy_reason",
              "checks",
              "result",
              "operation_id",
              "created_by",
              "approved_by",
              "approved_at",
              "created_at",
              "updated_at",
              "location_id",
              "form_seq",
              "form_effect",
              "identified_by"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "action": {
                "enum": [
                  "order_referral"
                ],
                "type": "string"
              },
              "approved_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "approved_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "checks": {
                "items": {
                  "$ref": "#/components/schemas/Check"
                },
                "type": "array"
              },
              "created_at": {
                "format": "date-time",
                "type": "string"
              },
              "created_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "form_effect": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "form_seq": {
                "format": "int64",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "form_version": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "identified_by": {
                "type": "string"
              },
              "input": {
                "additionalProperties": false,
                "properties": {
                  "findings": {
                    "description": "Befund for the receiving doctor",
                    "maxLength": 2000,
                    "type": "string"
                  },
                  "text": {
                    "description": "Whom the patient is referred to, and why",
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "type": "object"
              },
              "input_revision": {
                "format": "int64",
                "type": "integer"
              },
              "location_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "operation_id": {
                "type": "string"
              },
              "patient_ref": {
                "type": "string"
              },
              "policy_reason": {
                "type": "string"
              },
              "policy_version": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "practice_id": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              },
              "result": {
                "additionalProperties": false,
                "properties": {
                  "accepted": {
                    "items": {
                      "$ref": "#/components/schemas/Accepted"
                    },
                    "type": "array"
                  },
                  "calendar": {
                    "enum": [
                      "pvs",
                      "demo",
                      "atmos",
                      "samedi",
                      "webtermin",
                      "doctolib",
                      "patmed",
                      "terminico"
                    ],
                    "type": "string"
                  },
                  "error": {
                    "enum": [
                      "checks_failed",
                      "pvs_timeout",
                      "pvs_unavailable",
                      "pvs_error",
                      "calendar_login_refused",
                      "patient_data_missing",
                      "policy_off",
                      "computer_offline",
                      "agent_failed"
                    ],
                    "type": "string"
                  },
                  "items": {
                    "items": {
                      "$ref": "#/components/schemas/Item"
                    },
                    "type": "array"
                  },
                  "sent": {
                    "items": {
                      "$ref": "#/components/schemas/SentDetail"
                    },
                    "type": "array"
                  }
                },
                "type": [
                  "object",
                  "null"
                ]
              },
              "source": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "ticket_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "updated_at": {
                "format": "date-time",
                "type": "string"
              }
            },
            "required": [
              "id",
              "practice_id",
              "ticket_id",
              "action",
              "patient_ref",
              "source",
              "input",
              "input_revision",
              "request_id",
              "status",
              "policy_version",
              "form_version",
              "policy_reason",
              "checks",
              "result",
              "operation_id",
              "created_by",
              "approved_by",
              "approved_at",
              "created_at",
              "updated_at",
              "location_id",
              "form_seq",
              "form_effect",
              "identified_by"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "action": {
                "enum": [
                  "write_casefile"
                ],
                "type": "string"
              },
              "approved_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "approved_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "checks": {
                "items": {
                  "$ref": "#/components/schemas/Check"
                },
                "type": "array"
              },
              "created_at": {
                "format": "date-time",
                "type": "string"
              },
              "created_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "form_effect": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "form_seq": {
                "format": "int64",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "form_version": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "identified_by": {
                "type": "string"
              },
              "input": {
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "description": "Which kind of entry it is, for its default text group: ticket unless a sequence step writes it",
                    "enum": [
                      "ticket",
                      "sequence"
                    ],
                    "type": "string"
                  },
                  "text": {
                    "description": "Defaults to the ticket's title, summary, calls, forms and action outcomes",
                    "minLength": 1,
                    "type": "string"
                  },
                  "text_group": {
                    "description": "Kartei text group, see options; defaults to the one the practice set for its kind (GET /pvs/text-groups)",
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "text_group",
                  "text"
                ],
                "type": "object"
              },
              "input_revision": {
                "format": "int64",
                "type": "integer"
              },
              "location_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "operation_id": {
                "type": "string"
              },
              "patient_ref": {
                "type": "string"
              },
              "policy_reason": {
                "type": "string"
              },
              "policy_version": {
                "format": "int32",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "practice_id": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              },
              "result": {
                "additionalProperties": false,
                "properties": {
                  "accepted": {
                    "items": {
                      "$ref": "#/components/schemas/Accepted"
                    },
                    "type": "array"
                  },
                  "calendar": {
                    "enum": [
                      "pvs",
                      "demo",
                      "atmos",
                      "samedi",
                      "webtermin",
                      "doctolib",
                      "patmed",
                      "terminico"
                    ],
                    "type": "string"
                  },
                  "error": {
                    "enum": [
                      "checks_failed",
                      "pvs_timeout",
                      "pvs_unavailable",
                      "pvs_error",
                      "calendar_login_refused",
                      "patient_data_missing",
                      "policy_off",
                      "computer_offline",
                      "agent_failed"
                    ],
                    "type": "string"
                  },
                  "items": {
                    "items": {
                      "$ref": "#/components/schemas/Item"
                    },
                    "type": "array"
                  },
                  "sent": {
                    "items": {
                      "$ref": "#/components/schemas/SentDetail"
                    },
                    "type": "array"
                  }
                },
                "type": [
                  "object",
                  "null"
                ]
              },
              "source": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "ticket_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "updated_at": {
                "format": "date-time",
                "type": "string"
              }
            },
            "required": [
              "id",
              "practice_id",
              "ticket_id",
              "action",
              "patient_ref",
              "source",
              "input",
              "input_revision",
              "request_id",
              "status",
              "policy_version",
              "form_version",
              "policy_reason",
              "checks",
              "result",
              "operation_id",
              "created_by",
              "approved_by",
              "approved_at",
              "created_at",
              "updated_at",
              "location_id",
              "form_seq",
              "form_effect",
              "identified_by"
            ],
            "type": "object"
          }
        ]
      },
      "AddCommentInputBody": {
        "additionalProperties": false,
        "properties": {
          "body": {
            "description": "Its text; a note of files alone may have none",
            "maxLength": 10000,
            "type": "string"
          },
          "files": {
            "description": "The member's own uploads (POST /files), attached to the ticket with the note",
            "items": {
              "type": "string"
            },
            "maxItems": 20,
            "type": "array"
          },
          "mentions": {
            "description": "Member IDs; each gets the ticket in their \"mentioned me\" view, unread",
            "items": {
              "type": "string"
            },
            "maxItems": 50,
            "type": "array"
          }
        },
        "type": "object"
      },
      "Appointment": {
        "additionalProperties": false,
        "properties": {
          "calendar_id": {
            "type": "string"
          },
          "calendar_name": {
            "type": "string"
          },
          "duration_min": {
            "format": "int32",
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "reasons": {
            "items": {
              "$ref": "#/components/schemas/Reason"
            },
            "type": "array"
          },
          "start": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "calendar_id",
          "calendar_name",
          "start",
          "duration_min"
        ],
        "type": "object"
      },
      "AppointmentBody": {
        "additionalProperties": false,
        "properties": {
          "calendar_id": {
            "minLength": 1,
            "type": "string"
          },
          "contact": {
            "description": "An online type's (video appointment's): the email address or mobile number the patient gets its link at; default their own. Required when the patient has neither, or for someone not a known patient",
            "maxLength": 254,
            "type": "string"
          },
          "email": {
            "description": "Who comes, when not a known patient: their email address",
            "maxLength": 254,
            "type": "string"
          },
          "ends_at": {
            "description": "Within a day of starts_at for an appointment; a block (an absence) may span days",
            "format": "date-time",
            "type": "string"
          },
          "kind": {
            "default": "appointment",
            "enum": [
              "appointment",
              "block"
            ],
            "type": "string"
          },
          "parts": {
            "description": "The calendar to take for each of the type's needs, in their order; empty or missing: the first free one of its pool. Parts move and cancel with the appointment",
            "items": {
              "type": "string"
            },
            "maxItems": 5,
            "type": "array"
          },
          "patient_ref": {
            "description": "The patient in the practice system",
            "type": "string"
          },
          "phone": {
            "description": "Who comes, when not a known patient: their phone number",
            "maxLength": 40,
            "type": "string"
          },
          "starts_at": {
            "format": "date-time",
            "type": "string"
          },
          "take_over": {
            "description": "Book over what patients reserve in forms (409 slot_reserved): their reservations end, their forms say so",
            "type": "boolean"
          },
          "title": {
            "description": "Who comes, when not a known patient, or why time is blocked",
            "maxLength": 200,
            "type": "string"
          },
          "type_id": {
            "description": "An appointment type the calendar takes",
            "type": "string"
          }
        },
        "required": [
          "calendar_id",
          "starts_at",
          "ends_at"
        ],
        "type": "object"
      },
      "AppointmentType": {
        "additionalProperties": false,
        "properties": {
          "after": {
            "description": "Minutes its calendar stays free after it (cleaning, documentation), for staff bookings too",
            "format": "int64",
            "maximum": 120,
            "minimum": 0,
            "type": "integer"
          },
          "ahead": {
            "description": "Minutes before its start a slot of it becomes bookable by a form or booking action: an Akutsprechstunde at 14:00 with 240 (4 hours) opens at 10:00; 4 weeks: 40320. 0: as far ahead as the form step offers. Staff in the calendar are not held to it",
            "format": "int64",
            "maximum": 525600,
            "minimum": 0,
            "type": "integer"
          },
          "before": {
            "description": "Minutes its calendar stays free before it (preparation), for staff bookings too",
            "format": "int64",
            "maximum": 120,
            "minimum": 0,
            "type": "integer"
          },
          "category": {
            "description": "Groups types in lists, e.g. Akut, Vorsorge, Labor, Impfung",
            "maxLength": 60,
            "type": "string"
          },
          "color": {
            "description": "A palette colour (rose, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, pink, slate) or a custom hue h:0 to h:359, degrees of the OKLCH hue circle (h:212 sky blue): the app draws every colour at the theme's lightness, so a custom one fits as well as the palette's",
            "pattern": "^(rose|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|pink|slate|h:([0-9]|[1-9][0-9]|[12][0-9]{2}|3[0-5][0-9]))$",
            "type": "string"
          },
          "id": {
            "pattern": "^[a-z0-9_-]{1,64}$",
            "type": "string"
          },
          "insurance": {
            "description": "Whom a form or booking action books it for: all (default), statutory (gkv, HZV included) or private (pkv) patients; a patient whose insurance is unknown passes. Staff in the calendar are not held to it",
            "enum": [
              "all",
              "gkv",
              "pkv"
            ],
            "type": "string"
          },
          "minutes": {
            "description": "Length; a calendar's minutes may change it there",
            "format": "int64",
            "maximum": 480,
            "minimum": 5,
            "type": "integer"
          },
          "name": {
            "maxLength": 80,
            "minLength": 1,
            "type": "string"
          },
          "needs": {
            "description": "Further calendars (rooms, devices, staff) the appointment occupies besides its own, booked and moved with it: each need takes a free calendar of its pool at the location of the appointment's calendar, so a location with none in a pool has no slots for the type",
            "items": {
              "$ref": "#/components/schemas/Need"
            },
            "maxItems": 5,
            "type": "array"
          },
          "notice": {
            "description": "Minutes ahead a form or booking action must book it (2 days: 2880); 0: the practice's min_notice_minutes (actions_policy). Staff in the calendar are not held to it",
            "format": "int64",
            "maximum": 43200,
            "minimum": 0,
            "type": "integer"
          },
          "online": {
            "description": "A video appointment (Videosprechstunde): booking it makes a room at the practice's video provider (plugin meetone) and sends the patient its link by email or SMS, so every booking needs the patient's email address or mobile number",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "minutes"
        ],
        "type": "object"
      },
      "AppointmentsOutBody": {
        "additionalProperties": false,
        "properties": {
          "available": {
            "items": {
              "$ref": "#/components/schemas/Appointment"
            },
            "type": "array"
          },
          "booked": {
            "items": {
              "$ref": "#/components/schemas/Appointment"
            },
            "type": "array"
          },
          "calendar": {
            "description": "Where the appointments live (GET /calendar's source): atmos is the built-in calendar",
            "enum": [
              "atmos",
              "pvs",
              "demo",
              "samedi",
              "webtermin",
              "doctolib",
              "patmed",
              "terminico",
              ""
            ],
            "type": "string"
          },
          "reason_required": {
            "description": "Free slots were asked without reason, and this calendar (patmed) searches them only per visit reason: available is empty, ask again with one (GET /calendar's reasons)",
            "type": "boolean"
          }
        },
        "required": [
          "booked",
          "available",
          "calendar"
        ],
        "type": "object"
      },
      "AppointmentsOutBody1": {
        "additionalProperties": false,
        "properties": {
          "appointments": {
            "description": "Earliest first",
            "items": {
              "$ref": "#/components/schemas/Booked"
            },
            "type": "array"
          },
          "more": {
            "description": "There are more than limit: ask for fewer days or calendars",
            "type": "boolean"
          },
          "source": {
            "enum": [
              "atmos",
              "pvs",
              "demo",
              "samedi",
              "webtermin",
              "doctolib",
              "patmed",
              "terminico",
              "off"
            ],
            "type": "string"
          }
        },
        "required": [
          "source",
          "appointments"
        ],
        "type": "object"
      },
      "AttachmentReading": {
        "additionalProperties": false,
        "properties": {
          "coverage": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "pages": {
            "format": "int64",
            "type": "integer"
          },
          "read_pages": {
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "enum": [
              "read",
              "partial",
              "unsupported",
              "failed",
              "limit",
              "quota"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "status",
          "pages",
          "read_pages"
        ],
        "type": "object"
      },
      "Booked": {
        "additionalProperties": false,
        "properties": {
          "calendar_id": {
            "type": "string"
          },
          "email": {
            "description": "Who comes, when no patient record says it: their email address",
            "type": "string"
          },
          "ends_at": {
            "format": "date-time",
            "type": "string"
          },
          "held_until": {
            "description": "A patient reserves the time in a form until then; booked once they send it",
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "appointment",
              "block"
            ],
            "type": "string"
          },
          "note": {
            "description": "A practice system's free text on it",
            "type": "string"
          },
          "part_of": {
            "description": "The appointment whose need (a room or device) this part is",
            "type": "string"
          },
          "patient_ref": {
            "description": "The patient; get_patient names them",
            "type": "string"
          },
          "phone": {
            "description": "Who comes, when no patient record says it: their phone number",
            "type": "string"
          },
          "room": {
            "type": "string"
          },
          "starts_at": {
            "format": "date-time",
            "type": "string"
          },
          "tags": {
            "description": "A practice system's categories or marks",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "title": {
            "description": "Who comes (a practice system names its patient here), or why the time is blocked",
            "type": "string"
          },
          "type": {
            "description": "The appointment type or visit reason",
            "type": "string"
          }
        },
        "required": [
          "id",
          "calendar_id",
          "kind",
          "starts_at",
          "ends_at"
        ],
        "type": "object"
      },
      "BookingContact": {
        "additionalProperties": false,
        "properties": {
          "birthdate": {
            "format": "date",
            "type": "string"
          },
          "email": {
            "maxLength": 254,
            "type": "string"
          },
          "first_name": {
            "description": "With guest \"first last\": the first name, so a surname of several words stays whole",
            "maxLength": 100,
            "type": "string"
          },
          "last_name": {
            "maxLength": 100,
            "type": "string"
          },
          "phone": {
            "maxLength": 40,
            "type": "string"
          }
        },
        "type": "object"
      },
      "Break": {
        "additionalProperties": false,
        "properties": {
          "end": {
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "description": "The recurring block's id",
            "type": "string"
          },
          "start": {
            "format": "date-time",
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "start",
          "end"
        ],
        "type": "object"
      },
      "CalendarOutBody": {
        "additionalProperties": false,
        "properties": {
          "appointments": {
            "items": {
              "$ref": "#/components/schemas/ExternalAppointment"
            },
            "type": "array"
          },
          "calendars": {
            "items": {
              "$ref": "#/components/schemas/PracticeCalendar"
            },
            "type": "array"
          },
          "cancels": {
            "description": "A patient's appointment can be cancelled from atmOS: in the built-in calendar, or through cancel_appointment where the source takes it (not x.webtermin, nor a practice system whose adapter cannot)",
            "type": "boolean"
          },
          "guests": {
            "description": "The source books for someone who is no practice-system patient: by name (built-in), or by first and last name, birth date, phone and email (book_appointment's guest and contact)",
            "type": "boolean"
          },
          "lists": {
            "description": "The source can list the practice's appointments; without, the calendar only books (samedi lists them only per patient)",
            "type": "boolean"
          },
          "source": {
            "description": "Where the practice's appointments live (AutoConnect modules.calendar); webtermin only offers online slots and requests, without its full diary; doctolib is the practice's Doctolib; patmed only its online slots, and booking requests where switched on; terminico the free slots of its mappings, and reservations the practice accepts in Terminico",
            "enum": [
              "atmos",
              "pvs",
              "demo",
              "samedi",
              "webtermin",
              "doctolib",
              "patmed",
              "terminico",
              "off"
            ],
            "type": "string"
          },
          "unavailable": {
            "description": "The practice system did not answer: its appointments are missing",
            "type": "boolean"
          }
        },
        "required": [
          "source",
          "calendars",
          "appointments",
          "lists",
          "guests",
          "cancels"
        ],
        "type": "object"
      },
      "Candidate": {
        "additionalProperties": false,
        "properties": {
          "birth_date": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          }
        },
        "required": [
          "ref",
          "name",
          "birth_date"
        ],
        "type": "object"
      },
      "ChangedString": {
        "additionalProperties": false,
        "properties": {
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          }
        },
        "required": [
          "from",
          "to"
        ],
        "type": "object"
      },
      "ChangedUUID": {
        "additionalProperties": false,
        "properties": {
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          }
        },
        "required": [
          "from",
          "to"
        ],
        "type": "object"
      },
      "ChatIn": {
        "additionalProperties": false,
        "properties": {
          "files": {
            "description": "Photos or documents the patient sent with it",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "key": {
            "description": "The patient's id of the message, for their own retries",
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "text"
        ],
        "type": "object"
      },
      "Check": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "type": "string"
          },
          "item": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          },
          "warn": {
            "type": "boolean"
          }
        },
        "required": [
          "code",
          "ok"
        ],
        "type": "object"
      },
      "Comment": {
        "additionalProperties": false,
        "properties": {
          "body": {
            "type": "string"
          },
          "files": {
            "items": {
              "type": "string"
            },
            "maxItems": 20,
            "type": "array"
          },
          "mentions": {
            "items": {
              "type": "string"
            },
            "maxItems": 50,
            "type": "array"
          }
        },
        "required": [
          "body"
        ],
        "type": "object"
      },
      "CreateTicketInputBody": {
        "additionalProperties": false,
        "properties": {
          "assignee_id": {
            "description": "needs tickets.assign; a bot only from someone who may use it (Ilka: ai.use; a personal bot: its member)",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "$ref": "#/components/schemas/TicketCategory"
          },
          "contact": {
            "description": "Who called or came by: a name or a phone number",
            "maxLength": 200,
            "type": "string"
          },
          "description": {
            "description": "Shown under the title, like the summary of an incoming ticket",
            "maxLength": 10000,
            "type": "string"
          },
          "location_id": {
            "type": "string"
          },
          "priority": {
            "$ref": "#/components/schemas/TicketPriority"
          },
          "source": {
            "description": "A call staff took, someone at the counter, or the practice's own to-do",
            "enum": [
              "phone",
              "desk",
              "internal"
            ],
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/TicketStatus"
          },
          "team_id": {
            "description": "needs tickets.assign",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "maxLength": 200,
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "location_id",
          "title",
          "source"
        ],
        "type": "object"
      },
      "Day": {
        "additionalProperties": false,
        "properties": {
          "closed": {
            "description": "The rule closes the location all day",
            "type": "boolean"
          },
          "date": {
            "format": "date",
            "type": "string"
          },
          "holiday": {
            "description": "Public holiday code, e.g. all_saints",
            "type": "string"
          },
          "rule": {
            "description": "Title of the location's rule that sets the day's hours",
            "type": "string"
          }
        },
        "required": [
          "date",
          "closed"
        ],
        "type": "object"
      },
      "Document": {
        "additionalProperties": false,
        "properties": {
          "dienstkennung": {
            "description": "A KIM message's type (X-KIM-Dienstkennung)",
            "type": "string"
          },
          "extracted": {
            "type": "string"
          },
          "files": {
            "description": "The document as stored, such as the fax as PDF",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          },
          "omitted_files": {
            "items": {
              "$ref": "#/components/schemas/OmittedFile"
            },
            "type": "array"
          }
        },
        "required": [
          "name",
          "extracted"
        ],
        "type": "object"
      },
      "EditTicketBody": {
        "additionalProperties": false,
        "properties": {
          "assignee_id": {
            "description": "null clears; needs tickets.assign; a bot only from someone who may use it (Ilka: ai.use; a personal bot: its member)",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "$ref": "#/components/schemas/TicketCategory"
          },
          "location_id": {
            "description": "Needs tickets.read at the old and the new location",
            "type": "string"
          },
          "priority": {
            "$ref": "#/components/schemas/TicketPriority"
          },
          "snoozed_until": {
            "description": "null wakes the ticket now",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/TicketStatus"
          },
          "summary": {
            "description": "The text under the title; the analysis keeps one a person wrote",
            "maxLength": 10000,
            "type": "string"
          },
          "team_id": {
            "description": "null clears; needs tickets.assign",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "maxLength": 200,
            "minLength": 1,
            "type": "string"
          },
          "unread": {
            "description": "false also marks the caller's mentions on the ticket as seen",
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "EmailIn": {
        "additionalProperties": false,
        "properties": {
          "auto": {
            "description": "Sent by a machine (auto-reply, bounce, list): never answered automatically",
            "type": "boolean"
          },
          "body": {
            "type": "string"
          },
          "dienstkennung": {
            "description": "A KIM message's type (X-KIM-Dienstkennung), e.g. Arztbrief;VHitG-Versand;V1.2; empty for one without",
            "type": "string"
          },
          "files": {
            "description": "Its attachments",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "from": {
            "type": "string"
          },
          "html": {
            "description": "It has an HTML part, sanitized by GET /tickets/{id}/emails/{seq}/html; body stays its text",
            "type": "boolean"
          },
          "kim": {
            "description": "Came by KIM; the mail safe mode does not apply",
            "type": "boolean"
          },
          "message_id": {
            "description": "Its Message-ID header, which replies name in In-Reply-To",
            "type": "string"
          },
          "omitted_files": {
            "items": {
              "$ref": "#/components/schemas/OmittedFile"
            },
            "type": "array"
          },
          "safe": {
            "description": "Read in the practice's mail safe mode: links replaced by [Link entfernt], no HTML part, files listed but not opened. Never stored",
            "type": "boolean"
          },
          "subject": {
            "type": "string"
          }
        },
        "required": [
          "from",
          "subject",
          "body"
        ],
        "type": "object"
      },
      "ErrorDetail": {
        "additionalProperties": false,
        "properties": {
          "location": {
            "description": "Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'",
            "type": "string"
          },
          "message": {
            "description": "Error message text",
            "type": "string"
          },
          "value": {
            "description": "The value at the given location"
          }
        },
        "type": "object"
      },
      "ErrorModel": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "description": "Machine-readable reason, such as practice_suspended",
            "type": "string"
          },
          "detail": {
            "description": "A human-readable explanation specific to this occurrence of the problem.",
            "examples": [
              "Property foo is required but is missing."
            ],
            "type": "string"
          },
          "errors": {
            "description": "Optional list of individual error details",
            "items": {
              "$ref": "#/components/schemas/ErrorDetail"
            },
            "type": "array"
          },
          "instance": {
            "description": "A URI reference that identifies the specific occurrence of the problem.",
            "examples": [
              "https://example.com/error-log/abc123"
            ],
            "format": "uri",
            "type": "string"
          },
          "status": {
            "description": "HTTP status code",
            "examples": [
              400
            ],
            "format": "int64",
            "type": "integer"
          },
          "title": {
            "description": "A short, human-readable summary of the problem type. This value should not change between occurrences of the error.",
            "examples": [
              "Bad Request"
            ],
            "type": "string"
          },
          "trace_id": {
            "description": "The request's trace, for support to find what happened",
            "type": "string"
          },
          "type": {
            "default": "about:blank",
            "description": "A URI reference to human-readable documentation for the error.",
            "examples": [
              "https://example.com/errors/example"
            ],
            "format": "uri",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Event": {
        "additionalProperties": false,
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "created_by": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "payload": {
            "$ref": "#/components/schemas/EventPayload"
          },
          "seq": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "seq",
          "kind",
          "payload",
          "created_by",
          "created_at"
        ],
        "type": "object"
      },
      "EventPayload": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/EmailIn"
          },
          {
            "$ref": "#/components/schemas/ChatIn"
          },
          {
            "$ref": "#/components/schemas/Document"
          },
          {
            "$ref": "#/components/schemas/ChangedString"
          },
          {
            "$ref": "#/components/schemas/ChangedUUID"
          },
          {
            "$ref": "#/components/schemas/Comment"
          },
          {
            "$ref": "#/components/schemas/TaskEvent"
          },
          {
            "$ref": "#/components/schemas/AI"
          },
          {
            "$ref": "#/components/schemas/OrderPreparation"
          },
          {
            "$ref": "#/components/schemas/RequestDecision"
          },
          {
            "$ref": "#/components/schemas/Routed"
          },
          {
            "$ref": "#/components/schemas/MatchResult"
          },
          {
            "$ref": "#/components/schemas/RecurringOpened"
          },
          {
            "type": "object"
          }
        ]
      },
      "ExternalAppointment": {
        "additionalProperties": false,
        "properties": {
          "calendar_id": {
            "type": "string"
          },
          "ends_at": {
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "description": "Stable across reads: from its calendar, start and the practice system's id or, without one, the patient",
            "type": "string"
          },
          "note": {
            "description": "The practice's free text on it",
            "type": "string"
          },
          "patient": {
            "type": "string"
          },
          "patient_ref": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "room": {
            "type": "string"
          },
          "starts_at": {
            "format": "date-time",
            "type": "string"
          },
          "tags": {
            "description": "The practice's categories or marks",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "calendar_id",
          "starts_at",
          "ends_at",
          "reason"
        ],
        "type": "object"
      },
      "FreeSlot": {
        "additionalProperties": false,
        "properties": {
          "calendar_id": {
            "type": "string"
          },
          "end": {
            "format": "date-time",
            "type": "string"
          },
          "parts": {
            "description": "The further calendar each of the type's needs takes, in their order (built-in calendars)",
            "items": {
              "$ref": "#/components/schemas/Part"
            },
            "type": "array"
          },
          "start": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "calendar_id",
          "parts",
          "start",
          "end"
        ],
        "type": "object"
      },
      "HistoryEvent": {
        "additionalProperties": false,
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "created_by": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "payload": {
            "$ref": "#/components/schemas/EventPayload"
          },
          "seq": {
            "format": "int64",
            "type": "integer"
          },
          "ticket_id": {
            "description": "Absent on a Kartei entry",
            "type": "string"
          },
          "ticket_number": {
            "format": "int64",
            "type": "integer"
          },
          "untimed": {
            "description": "A Kartei entry or PVS document dated without a time of day: show its date only",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "seq",
          "kind",
          "payload",
          "created_by",
          "created_at"
        ],
        "type": "object"
      },
      "HistoryFile": {
        "additionalProperties": false,
        "properties": {
          "content_type": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "size": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "content_type",
          "size"
        ],
        "type": "object"
      },
      "HistoryOutputBody": {
        "additionalProperties": false,
        "properties": {
          "files": {
            "description": "The files the items attach",
            "items": {
              "$ref": "#/components/schemas/HistoryFile"
            },
            "type": "array"
          },
          "items": {
            "description": "Newest first. A Kartei entry has kind casefile and the payload text_group (its code), text_group_label (its name), text, user and fields ([label, value] pairs of a structured entry); a document the practice system holds has kind pvs_document and a PVSDocument as its payload",
            "items": {
              "$ref": "#/components/schemas/HistoryEvent"
            },
            "type": "array"
          },
          "next_cursor": {
            "description": "Absent on the last page",
            "type": "string"
          }
        },
        "required": [
          "items",
          "files"
        ],
        "type": "object"
      },
      "Insurance": {
        "additionalProperties": false,
        "properties": {
          "card_read_at": {
            "description": "Recorded insurance-card read date; not certification of a successful modern eGK transaction",
            "format": "date-time",
            "type": "string"
          },
          "card_read_this_month": {
            "description": "PVS-reported calendar-month status; absent when unknown",
            "type": "boolean"
          },
          "card_read_this_quarter": {
            "description": "Whether a known read date falls in this quarter; false also when no date is known",
            "type": "boolean"
          },
          "kind": {
            "enum": [
              "gkv",
              "hzv",
              "private",
              "unknown"
            ],
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "number": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "name",
          "number",
          "card_read_this_quarter"
        ],
        "type": "object"
      },
      "Item": {
        "additionalProperties": false,
        "properties": {
          "key": {
            "description": "PZN, appointment start, referral id, or pickup",
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "result": {
            "enum": [
              "done",
              "manual",
              "failed"
            ],
            "type": "string"
          }
        },
        "required": [
          "key",
          "result"
        ],
        "type": "object"
      },
      "ListTicketsOutputBody": {
        "additionalProperties": false,
        "properties": {
          "items": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "analysis_error": {
                  "type": "string"
                },
                "analysis_revision": {
                  "format": "int64",
                  "type": "integer"
                },
                "assignee_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "casefile_written_at": {
                  "format": "date-time",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "category": {
                  "$ref": "#/components/schemas/TicketCategory"
                },
                "channel": {
                  "$ref": "#/components/schemas/TicketChannel"
                },
                "closed_at": {
                  "format": "date-time",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "contact": {
                  "type": "string"
                },
                "created_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "created_by": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "erased_at": {
                  "format": "date-time",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "ilka_failed": {
                  "description": "Ilka gave it up, with why (mark_ticket_failed); null otherwise",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "input_revision": {
                  "format": "int64",
                  "type": "integer"
                },
                "last_seq": {
                  "format": "int64",
                  "type": "integer"
                },
                "location_id": {
                  "type": "string"
                },
                "number": {
                  "format": "int64",
                  "type": "integer"
                },
                "patient_ref": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "person": {
                  "$ref": "#/components/schemas/Person"
                },
                "practice_id": {
                  "type": "string"
                },
                "priority": {
                  "$ref": "#/components/schemas/TicketPriority"
                },
                "recurring_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "recurring_on": {
                  "format": "date-time",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "snoozed_until": {
                  "format": "date-time",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "$ref": "#/components/schemas/TicketStatus"
                },
                "summary": {
                  "type": "string"
                },
                "team_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "thread_key": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "triaging": {
                  "type": "boolean"
                },
                "unread": {
                  "type": "boolean"
                },
                "updated_at": {
                  "format": "date-time",
                  "type": "string"
                }
              },
              "required": [
                "id",
                "practice_id",
                "number",
                "location_id",
                "team_id",
                "assignee_id",
                "created_by",
                "status",
                "priority",
                "category",
                "channel",
                "contact",
                "person",
                "patient_ref",
                "thread_key",
                "unread",
                "triaging",
                "input_revision",
                "analysis_revision",
                "analysis_error",
                "title",
                "summary",
                "snoozed_until",
                "last_seq",
                "created_at",
                "updated_at",
                "closed_at",
                "casefile_written_at",
                "erased_at",
                "recurring_id",
                "recurring_on",
                "ilka_failed"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "next_cursor": {
            "description": "Absent on the last page",
            "type": "string"
          },
          "total": {
            "description": "Tickets matching the filter from this page on: on the first page, all of them",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total"
        ],
        "type": "object"
      },
      "MatchResult": {
        "additionalProperties": false,
        "properties": {
          "candidates": {
            "items": {
              "$ref": "#/components/schemas/Candidate"
            },
            "type": "array"
          },
          "reason": {
            "enum": [
              "hint",
              "phone",
              "name_birth",
              "name"
            ],
            "type": "string"
          },
          "status": {
            "enum": [
              "matched",
              "ambiguous",
              "none"
            ],
            "type": "string"
          }
        },
        "required": [
          "status",
          "candidates"
        ],
        "type": "object"
      },
      "Medication": {
        "additionalProperties": false,
        "properties": {
          "aut_idem": {
            "description": "The last prescription's aut-idem mark as the practice software has it; absent where it cannot say",
            "type": "boolean"
          },
          "dosage": {
            "type": "string"
          },
          "e_prescription": {
            "description": "The last prescription's e-prescription; absent without one or where the practice software cannot say",
            "enum": [
              "sent",
              "unsent",
              "cancelled",
              "failed"
            ],
            "type": "string"
          },
          "end_date": {
            "description": "Estimated end",
            "format": "date",
            "type": "string"
          },
          "evening": {
            "type": "string"
          },
          "external": {
            "description": "Marked extern on the medication plan; absent when unknown",
            "type": "boolean"
          },
          "form": {
            "type": "string"
          },
          "heading_closed": {
            "description": "Under a heading of the plan the practice takes no orders from (medication_orders headings): never orderable",
            "type": "boolean"
          },
          "morning": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "night": {
            "type": "string"
          },
          "noon": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "order_placed_at": {
            "description": "The last order; where the practice software keeps no orders (medatixx), the day of the last prescription",
            "format": "date",
            "type": "string"
          },
          "order_status": {
            "enum": [
              "pending",
              "processing",
              "reviewing",
              "cancelled",
              "rejected",
              "ready"
            ],
            "type": "string"
          },
          "orderable": {
            "type": "boolean"
          },
          "pack_size": {
            "description": "Pack size of the last prescription, as the practice software writes it",
            "type": "string"
          },
          "prescribed": {
            "description": "Its last prescription has a prescription record (medatixx); false: never prescribed in the practice, no last prescription to go by. Absent where the practice software cannot say",
            "type": "boolean"
          },
          "prescribed_as": {
            "description": "How the last prescription was found (medatixx): the entry's own row, another prescription of its PZN, or one of another product with the same substances in the same strengths (prescribed_name)",
            "enum": [
              "own",
              "same_pzn",
              "same_substance"
            ],
            "type": "string"
          },
          "prescribed_name": {
            "description": "The product of the last prescription where it is another than the entry's (same_substance)",
            "type": "string"
          },
          "prescribed_pzn": {
            "description": "Its PZN",
            "type": "string"
          },
          "prescription_forbidden": {
            "type": "boolean"
          },
          "pzn": {
            "type": "string"
          },
          "quantity": {
            "description": "Packs on the last prescription",
            "format": "int32",
            "type": "integer"
          },
          "reason": {
            "type": "string"
          },
          "reorder_after": {
            "format": "date",
            "type": "string"
          },
          "runs_out_at": {
            "format": "date",
            "type": "string"
          },
          "start_date": {
            "format": "date",
            "type": "string"
          },
          "substances": {
            "items": {
              "$ref": "#/components/schemas/Substance"
            },
            "type": "array"
          },
          "unit": {
            "description": "Unit of the amounts, as Stück or ml",
            "type": "string"
          }
        },
        "required": [
          "pzn",
          "name",
          "form",
          "dosage",
          "reason",
          "prescription_forbidden",
          "orderable"
        ],
        "type": "object"
      },
      "MentionView": {
        "additionalProperties": false,
        "properties": {
          "member_id": {
            "type": "string"
          },
          "mentioned_at": {
            "format": "date-time",
            "type": "string"
          },
          "practice_id": {
            "type": "string"
          },
          "seen_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "ticket_id": {
            "type": "string"
          }
        },
        "required": [
          "practice_id",
          "ticket_id",
          "member_id",
          "mentioned_at",
          "seen_at"
        ],
        "type": "object"
      },
      "Need": {
        "additionalProperties": false,
        "properties": {
          "calendars": {
            "description": "Ids of calendars any one of which serves, tried in this order: of these, those at the location of the appointment's calendar, so name one per location. None of them may take the type itself",
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "type": "array"
          },
          "minutes": {
            "description": "Minutes it is needed; 0: until the appointment ends",
            "format": "int64",
            "maximum": 480,
            "minimum": 0,
            "type": "integer"
          },
          "offset": {
            "description": "Minutes after the appointment's start it is needed from",
            "format": "int64",
            "maximum": 480,
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "calendars"
        ],
        "type": "object"
      },
      "OmittedFile": {
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "reason": {
            "enum": [
              "unsupported",
              "too_large",
              "empty",
              "undecodable"
            ],
            "type": "string"
          }
        },
        "required": [
          "name",
          "reason"
        ],
        "type": "object"
      },
      "Option": {
        "additionalProperties": false,
        "properties": {
          "detail": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "value": {
            "additionalProperties": {},
            "description": "The input fields this choice sets",
            "type": "object"
          },
          "what": {
            "description": "A booked appointment: what it is for",
            "type": "string"
          },
          "who": {
            "description": "A booked appointment: whom it is with, where the calendar names someone (Appointment)",
            "type": "string"
          }
        },
        "required": [
          "value",
          "label"
        ],
        "type": "object"
      },
      "OptionsOutBody1": {
        "additionalProperties": false,
        "properties": {
          "details": {
            "description": "book_appointment: what the calendar needs of who comes that the patient's record lacks, all of it for a guest: given in input.contact",
            "items": {
              "enum": [
                "first_name",
                "last_name",
                "birth_date",
                "phone",
                "email"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "guest": {
            "$ref": "#/components/schemas/BookingContact",
            "description": "cancel_appointment for a ticket without a patient: whose bookings are listed: the ticket's number, with the name and birth date of partial.contact, else the ticket's contact's (person)"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/Option"
            },
            "type": "array"
          },
          "questions": {
            "description": "book_appointment with a reason_id: the visit reason's questions still to ask (the patient's record answers the rest), answered in input.questionnaire",
            "items": {
              "$ref": "#/components/schemas/Question"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "OrderPreparation": {
        "additionalProperties": false,
        "properties": {
          "error": {
            "enum": [
              "",
              "pvs_unavailable",
              "failed",
              "unsupported"
            ],
            "type": "string"
          },
          "revision": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "revision",
          "error"
        ],
        "type": "object"
      },
      "Part": {
        "additionalProperties": false,
        "properties": {
          "calendar_id": {
            "type": "string"
          },
          "end": {
            "format": "date-time",
            "type": "string"
          },
          "start": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "calendar_id",
          "start",
          "end"
        ],
        "type": "object"
      },
      "Patient": {
        "additionalProperties": false,
        "properties": {
          "birth_date": {
            "format": "date",
            "type": "string"
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "prefix_name": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          }
        },
        "required": [
          "ref",
          "name",
          "first_name",
          "last_name",
          "birth_date"
        ],
        "type": "object"
      },
      "PatientHit": {
        "additionalProperties": false,
        "properties": {
          "birth_date": {
            "format": "date",
            "type": "string"
          },
          "city": {
            "description": "Where they live, given when another patient found has the same name, to tell them apart",
            "type": "string"
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "prefix_name": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          }
        },
        "required": [
          "ref",
          "name",
          "first_name",
          "last_name",
          "birth_date"
        ],
        "type": "object"
      },
      "PatientsOutBody": {
        "additionalProperties": false,
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/PatientHit"
            },
            "type": "array"
          },
          "total": {
            "description": "How many matched; items are the first limit of them",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total"
        ],
        "type": "object"
      },
      "Person": {
        "additionalProperties": false,
        "properties": {
          "birth_date": {
            "$ref": "#/components/schemas/PersonDetail",
            "description": "value YYYY-MM-DD"
          },
          "email": {
            "$ref": "#/components/schemas/PersonDetail",
            "description": "value lowercase"
          },
          "first_name": {
            "$ref": "#/components/schemas/PersonDetail"
          },
          "last_name": {
            "$ref": "#/components/schemas/PersonDetail"
          },
          "phone": {
            "$ref": "#/components/schemas/PersonDetail",
            "description": "value in E.164"
          }
        },
        "type": "object"
      },
      "PersonDetail": {
        "additionalProperties": false,
        "properties": {
          "source": {
            "$ref": "#/components/schemas/PersonSource"
          },
          "value": {
            "type": "string"
          },
          "verified": {
            "description": "Known to be right: staff entered it, or it is the address the ticket came from",
            "type": "boolean"
          }
        },
        "required": [
          "value",
          "source",
          "verified"
        ],
        "type": "object"
      },
      "PersonSource": {
        "enum": [
          "staff",
          "call",
          "form",
          "analysis",
          "address"
        ],
        "type": "string"
      },
      "PersonValues": {
        "additionalProperties": false,
        "properties": {
          "birth_date": {
            "description": "YYYY-MM-DD",
            "type": "string"
          },
          "email": {
            "maxLength": 254,
            "type": "string"
          },
          "first_name": {
            "maxLength": 100,
            "type": "string"
          },
          "last_name": {
            "maxLength": 100,
            "type": "string"
          },
          "phone": {
            "maxLength": 40,
            "type": "string"
          }
        },
        "type": "object"
      },
      "Plan": {
        "additionalProperties": false,
        "properties": {
          "approved": {
            "type": "boolean"
          },
          "approved_at": {
            "description": "When approved_by last saved or printed the plan, where atmOS approves plans by who saved them (medatixx)",
            "format": "date-time",
            "type": "string"
          },
          "approved_by": {
            "type": "string"
          },
          "changed_at": {
            "format": "date-time",
            "type": "string"
          },
          "changed_by": {
            "description": "Not approved because the plan changed after this approving member last saved it (changed_at)",
            "type": "string"
          },
          "early_at": {
            "format": "date-time",
            "type": "string"
          },
          "early_by": {
            "description": "Not approved because this approving member last saved the plan (early_at) before the day saves count from (medication_orders approval_from): saved again, it is",
            "type": "string"
          },
          "groups": {
            "description": "The plan's headings (Überschriften) as the practice software groups it, in its order, each with the PZNs under it; one without a name holds entries under none. An entry under several headings is in each. Absent where the practice software groups nothing",
            "items": {
              "$ref": "#/components/schemas/PlanGroup"
            },
            "type": "array"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/Medication"
            },
            "type": "array"
          }
        },
        "required": [
          "approved",
          "approved_by",
          "items"
        ],
        "type": "object"
      },
      "PlanGroup": {
        "additionalProperties": false,
        "properties": {
          "closed": {
            "description": "The practice takes no orders from this heading (medication_orders headings)",
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "pzns": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "name",
          "pzns"
        ],
        "type": "object"
      },
      "PracticeCalendar": {
        "additionalProperties": false,
        "properties": {
          "bookable": {
            "description": "The caller may book here: directly in a built-in calendar, through a book_appointment action (a ticket, then the practice's approval) in a practice system's that can book",
            "type": "boolean"
          },
          "breaks": {
            "description": "Its recurring blocks (built-in), e.g. Mittagspause, on the requested days",
            "items": {
              "$ref": "#/components/schemas/Break"
            },
            "type": "array"
          },
          "capacity": {
            "description": "How many appointments or parts it holds at once (built-in; a practice system's: 1)",
            "format": "int64",
            "type": "integer"
          },
          "color": {
            "description": "A palette colour (rose, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, pink, slate) or a custom hue h:0 to h:359, degrees of the OKLCH hue circle (h:212 sky blue): the app draws every colour at the theme's lightness, so a custom one fits as well as the palette's",
            "pattern": "^(rose|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|pink|slate|h:([0-9]|[1-9][0-9]|[12][0-9]{2}|3[0-5][0-9]))$",
            "type": "string"
          },
          "days": {
            "description": "The requested days its location marks: public holidays, and days a rule closes or sets the hours of",
            "items": {
              "$ref": "#/components/schemas/Day"
            },
            "type": "array"
          },
          "editable": {
            "description": "Built-in and the caller may book, move and cancel here",
            "type": "boolean"
          },
          "hours": {
            "description": "Open is known: a built-in calendar's hours, or the opening hours of the location a practice system's calendar is placed at",
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "description": "A built-in calendar's kind",
            "enum": [
              "doctor",
              "staff",
              "room",
              "device"
            ],
            "type": "string"
          },
          "location_id": {
            "description": "Empty: a practice system's calendar placed at no location",
            "type": [
              "string",
              "null"
            ]
          },
          "member": {
            "description": "The team member whose calendar it is",
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "open": {
            "description": "When it takes appointments (built-in: its hours, closed when its location's rules close, without its breaks) or its location is open (practice system) on the requested days",
            "items": {
              "$ref": "#/components/schemas/Span"
            },
            "type": "array"
          },
          "step": {
            "description": "Minutes between slot starts",
            "format": "int64",
            "type": "integer"
          },
          "types": {
            "description": "What it books, with their minutes on this calendar; a practice system's visit reasons have no minutes",
            "items": {
              "$ref": "#/components/schemas/AppointmentType"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "name",
          "location_id",
          "color",
          "editable",
          "bookable",
          "step",
          "capacity",
          "types",
          "hours",
          "open",
          "breaks",
          "days"
        ],
        "type": "object"
      },
      "ProposeInputBody1": {
        "additionalProperties": false,
        "properties": {
          "input": {
            "description": "The action's input, see its schema"
          },
          "patient_ref": {
            "description": "The ticket's patient; empty for a ticket without one: book_appointment then books its contact (guest) in a built-in calendar, order_freetext_medication can be drafted without a patient but cannot execute until linked; other actions return 409 patient_required",
            "type": "string"
          },
          "request_id": {
            "description": "Detected request this proposal resolves; must belong to the current analysis",
            "maxLength": 100,
            "type": "string"
          },
          "ticket_id": {
            "type": "string"
          }
        },
        "required": [
          "ticket_id",
          "patient_ref",
          "input"
        ],
        "type": "object"
      },
      "Question": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "name": {
            "description": "The field's name in the PVS: the answer's key",
            "type": "string"
          },
          "type": {
            "description": "label, textfield, textfield_mandatory, checkbox, checkbox_mandatory, single_selection or multi_selection; selections are always required, another type is shown as a label",
            "type": "string"
          }
        },
        "required": [
          "name",
          "type"
        ],
        "type": "object"
      },
      "Reason": {
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "type": "object"
      },
      "Record": {
        "additionalProperties": false,
        "properties": {
          "birth_date": {
            "format": "date",
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "first_name": {
            "type": "string"
          },
          "height_cm": {
            "description": "As last recorded in the practice system",
            "format": "double",
            "type": "number"
          },
          "insurance": {
            "$ref": "#/components/schemas/Insurance"
          },
          "last_name": {
            "type": "string"
          },
          "linked_in_app": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "picture": {
            "description": "The patient's own portal account has a picture: GET /patients/{ref}/picture",
            "type": "boolean"
          },
          "prefix_name": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          },
          "referrer": {
            "description": "The doctor who referred the patient, as the practice system names them",
            "type": "string"
          },
          "sex": {
            "type": "string"
          },
          "street": {
            "type": "string"
          },
          "weight_kg": {
            "description": "As last recorded in the practice system",
            "format": "double",
            "type": "number"
          },
          "zip_code": {
            "type": "string"
          }
        },
        "required": [
          "sex",
          "phone",
          "email",
          "street",
          "zip_code",
          "city",
          "linked_in_app",
          "insurance",
          "ref",
          "name",
          "first_name",
          "last_name",
          "birth_date"
        ],
        "type": "object"
      },
      "RecurringOpened": {
        "additionalProperties": false,
        "properties": {
          "assignee_id": {
            "type": "string"
          },
          "recurring_id": {
            "type": "string"
          },
          "skipped": {
            "format": "int64",
            "type": "integer"
          },
          "team_id": {
            "type": "string"
          }
        },
        "required": [
          "recurring_id"
        ],
        "type": "object"
      },
      "Reply": {
        "additionalProperties": false,
        "properties": {
          "attachments": {
            "description": "Uploaded files: in the portal conversation as they are, and among the patient's documents there",
            "items": {
              "type": "string"
            },
            "maxItems": 20,
            "type": "array"
          },
          "bcc": {
            "items": {
              "type": "string"
            },
            "maxItems": 20,
            "type": "array"
          },
          "body": {
            "description": "Final text, empty only with attachments or a form; snippets are rendered by POST /snippets/render",
            "maxLength": 20000,
            "type": "string"
          },
          "cc": {
            "items": {
              "type": "string"
            },
            "maxItems": 20,
            "type": "array"
          },
          "channel": {
            "description": "chat: into the portal, with a notice without its text where they have no account yet (GET /tickets/{id}/chat-route); email or SMS only on a ticket without a patient that came that way, SMS to the number of a call without one, or either to the address a guest's form gave (GET /tickets/{id}/chat-route direct); kim: on a ticket that came by KIM, to its sender's KIM address, text only (409 kim_off, kim_incomplete or kim_product_id_missing while it cannot go)",
            "enum": [
              "sms",
              "email",
              "chat",
              "kim"
            ],
            "type": "string"
          },
          "confirm": {
            "description": "Chat with a notice, which invites the patient to the portal, to an address not on their record (GET /tickets/{id}/chat-route invite confirm): staff confirm that whoever holds it gets the patient's portal access; else 409 invite_unconfirmed. Email or SMS to a guest form's address staff have not written to on the ticket yet (direct confirm): staff confirm that the reply goes there; else 409 direct_unconfirmed",
            "type": "boolean"
          },
          "form": {
            "description": "A form (its key) for the ticket's patient to fill in: its link on its own line below the text, else alone; the answers join the ticket",
            "maxLength": 100,
            "type": "string"
          },
          "from": {
            "description": "Email: the mailbox to send from (GET /mailboxes/senders); default the location's",
            "type": "string"
          },
          "library": {
            "description": "Documents of the practice's library (library_documents) to give the patient in the portal",
            "items": {
              "type": "string"
            },
            "maxItems": 20,
            "type": "array"
          },
          "mentions": {
            "description": "Colleagues mentioned in the body as @[member_id], as in a note; each gets the ticket in their \"mentioned me\" view, the patient reads their name",
            "items": {
              "type": "string"
            },
            "maxItems": 50,
            "type": "array"
          },
          "snippet_key": {
            "maxLength": 100,
            "type": "string"
          },
          "subject": {
            "description": "Email; defaults to Re: and the ticket title",
            "maxLength": 300,
            "type": "string"
          },
          "to": {
            "description": "Email or SMS; defaults to the ticket's contact",
            "maxLength": 320,
            "type": "string"
          }
        },
        "required": [
          "channel",
          "body"
        ],
        "type": "object"
      },
      "Request": {
        "additionalProperties": false,
        "properties": {
          "evidence": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "prescription",
              "appointment",
              "cancellation",
              "referral",
              "findings",
              "vaccination",
              "question"
            ],
            "type": "string"
          },
          "medications": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "records": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "source_seq": {
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "enum": [
              "review",
              "needs_info"
            ],
            "type": "string"
          },
          "summary": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "summary",
          "evidence",
          "source_seq",
          "status"
        ],
        "type": "object"
      },
      "RequestDecision": {
        "additionalProperties": false,
        "properties": {
          "request_id": {
            "type": "string"
          },
          "status": {
            "enum": [
              "handled",
              "dismissed"
            ],
            "type": "string"
          }
        },
        "required": [
          "request_id",
          "status"
        ],
        "type": "object"
      },
      "Routed": {
        "additionalProperties": false,
        "properties": {
          "assignee_id": {
            "type": "string"
          },
          "location_id": {
            "type": "string"
          },
          "rule": {
            "format": "int64",
            "type": "integer"
          },
          "team_id": {
            "type": "string"
          }
        },
        "required": [
          "rule"
        ],
        "type": "object"
      },
      "Row": {
        "additionalProperties": false,
        "properties": {
          "booked_by": {
            "type": "string"
          },
          "buffer_after": {
            "format": "int32",
            "type": "integer"
          },
          "buffer_before": {
            "format": "int32",
            "type": "integer"
          },
          "calendar_id": {
            "type": "string"
          },
          "cancelled_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "cancelled_by": {
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "ends_at": {
            "format": "date-time",
            "type": "string"
          },
          "held_until": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "hold": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "appointment",
              "block"
            ],
            "type": "string"
          },
          "location_id": {
            "type": "string"
          },
          "part_of": {
            "type": "string"
          },
          "patient_ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": "string"
          },
          "practice_id": {
            "type": "string"
          },
          "run_id": {
            "type": "string"
          },
          "starts_at": {
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "description": "held: a patient reserves the time in a form until held_until",
            "enum": [
              "booked",
              "cancelled",
              "held"
            ],
            "type": "string"
          },
          "step_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "ticket_id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "type_id": {
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "kind",
          "status",
          "id",
          "practice_id",
          "location_id",
          "calendar_id",
          "starts_at",
          "ends_at",
          "type_id",
          "patient_ref",
          "title",
          "booked_by",
          "cancelled_by",
          "cancelled_at",
          "created_at",
          "updated_at",
          "part_of",
          "buffer_before",
          "buffer_after",
          "hold",
          "held_until",
          "run_id",
          "step_id",
          "ticket_id",
          "phone",
          "email"
        ],
        "type": "object"
      },
      "Run": {
        "additionalProperties": false,
        "properties": {
          "end_reason": {
            "description": "done or released when it finished; expired, interrupted, taken or offline when not; empty while it runs",
            "type": "string"
          },
          "ended_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "link": {
            "description": "Opens the ticket with the run's video",
            "type": "string"
          },
          "skill": {
            "description": "The skill she worked by (read_skill), if any",
            "type": "string"
          },
          "skill_source": {
            "enum": [
              "default",
              "custom",
              "own"
            ],
            "type": "string"
          },
          "skill_version": {
            "description": "Its version: the default's Standard \u003cversion\u003e for skill_source default, else the practice's Fassung \u003cversion\u003e",
            "format": "int32",
            "type": "integer"
          },
          "started_at": {
            "format": "date-time",
            "type": "string"
          },
          "video": {
            "description": "The screen recording is kept (until the retention's video days pass)",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "started_at",
          "ended_at",
          "end_reason",
          "video",
          "link"
        ],
        "type": "object"
      },
      "SentDetail": {
        "additionalProperties": false,
        "properties": {
          "field": {
            "enum": [
              "first_name",
              "last_name",
              "birth_date",
              "phone",
              "email"
            ],
            "type": "string"
          },
          "missing": {
            "description": "Required, and absent or in a shape the calendar refuses (Missing)",
            "type": "boolean"
          },
          "required": {
            "description": "The calendar books the visit reason by it",
            "type": "boolean"
          },
          "source": {
            "description": "record: the patient's record; ticket: what the call, form or message said, unchecked; address: the address the ticket came from (the calling number, the sender's address); staff: typed in by hand (by_hand)",
            "enum": [
              "record",
              "ticket",
              "address",
              "staff"
            ],
            "type": "string"
          },
          "value": {
            "description": "As sent; a birth date as YYYY-MM-DD",
            "type": "string"
          }
        },
        "required": [
          "field",
          "value"
        ],
        "type": "object"
      },
      "SentOutputBody": {
        "additionalProperties": false,
        "properties": {
          "outbound_id": {
            "type": "string"
          },
          "seq": {
            "format": "int64",
            "type": "integer"
          },
          "ticket_id": {
            "type": "string"
          }
        },
        "required": [
          "ticket_id",
          "outbound_id",
          "seq"
        ],
        "type": "object"
      },
      "SeqOutputBody1": {
        "additionalProperties": false,
        "properties": {
          "seq": {
            "description": "Sequence number of the appended event",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "seq"
        ],
        "type": "object"
      },
      "SlotsOutBody1": {
        "additionalProperties": false,
        "properties": {
          "slots": {
            "description": "Earliest first",
            "items": {
              "$ref": "#/components/schemas/FreeSlot"
            },
            "type": "array"
          }
        },
        "required": [
          "slots"
        ],
        "type": "object"
      },
      "Span": {
        "additionalProperties": false,
        "properties": {
          "end": {
            "format": "date-time",
            "type": "string"
          },
          "start": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "start",
          "end"
        ],
        "type": "object"
      },
      "Substance": {
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "strength": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "type": "object"
      },
      "TaskEvent": {
        "additionalProperties": false,
        "properties": {
          "assignee_id": {
            "type": "string"
          },
          "op": {
            "type": "string"
          },
          "task_id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "op"
        ],
        "type": "object"
      },
      "TicketCategory": {
        "description": "A key of the practice's ticket labels (list_ticket_labels); empty is none",
        "pattern": "^[a-z0-9_]{0,40}$",
        "type": "string"
      },
      "TicketChannel": {
        "enum": [
          "phone",
          "email",
          "fax",
          "scan",
          "chat",
          "form",
          "desk",
          "internal",
          "order",
          "cancel",
          "kim"
        ],
        "type": "string"
      },
      "TicketDetailOutputBody": {
        "additionalProperties": false,
        "properties": {
          "events": {
            "description": "The activity, oldest first",
            "items": {
              "$ref": "#/components/schemas/Event"
            },
            "type": "array"
          },
          "mention": {
            "$ref": "#/components/schemas/MentionView",
            "description": "Where the caller was mentioned on the ticket; seen_at null is unread"
          },
          "runs": {
            "description": "Ilka's sessions on a practice PC for the ticket, oldest first",
            "items": {
              "$ref": "#/components/schemas/Run"
            },
            "type": "array"
          },
          "tasks": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "assignee_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "done": {
                  "type": "boolean"
                },
                "id": {
                  "type": "string"
                },
                "location_id": {
                  "type": "string"
                },
                "position": {
                  "format": "int32",
                  "type": "integer"
                },
                "practice_id": {
                  "type": "string"
                },
                "ticket_id": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "practice_id",
                "ticket_id",
                "location_id",
                "title",
                "done",
                "assignee_id",
                "position",
                "created_at"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "ticket": {
            "additionalProperties": false,
            "properties": {
              "analysis_error": {
                "type": "string"
              },
              "analysis_revision": {
                "format": "int64",
                "type": "integer"
              },
              "assignee_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "casefile_written_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "category": {
                "$ref": "#/components/schemas/TicketCategory"
              },
              "channel": {
                "$ref": "#/components/schemas/TicketChannel"
              },
              "closed_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "contact": {
                "type": "string"
              },
              "created_at": {
                "format": "date-time",
                "type": "string"
              },
              "created_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "erased_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "ilka_failed": {
                "description": "Ilka gave it up, with why (mark_ticket_failed); null otherwise",
                "type": [
                  "string",
                  "null"
                ]
              },
              "input_revision": {
                "format": "int64",
                "type": "integer"
              },
              "last_seq": {
                "format": "int64",
                "type": "integer"
              },
              "location_id": {
                "type": "string"
              },
              "number": {
                "format": "int64",
                "type": "integer"
              },
              "patient_ref": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "person": {
                "$ref": "#/components/schemas/Person"
              },
              "practice_id": {
                "type": "string"
              },
              "priority": {
                "$ref": "#/components/schemas/TicketPriority"
              },
              "recurring_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "recurring_on": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "snoozed_until": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "$ref": "#/components/schemas/TicketStatus"
              },
              "summary": {
                "type": "string"
              },
              "team_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "thread_key": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "title": {
                "type": "string"
              },
              "triaging": {
                "type": "boolean"
              },
              "unread": {
                "type": "boolean"
              },
              "updated_at": {
                "format": "date-time",
                "type": "string"
              }
            },
            "required": [
              "id",
              "practice_id",
              "number",
              "location_id",
              "team_id",
              "assignee_id",
              "created_by",
              "status",
              "priority",
              "category",
              "channel",
              "contact",
              "person",
              "patient_ref",
              "thread_key",
              "unread",
              "triaging",
              "input_revision",
              "analysis_revision",
              "analysis_error",
              "title",
              "summary",
              "snoozed_until",
              "last_seq",
              "created_at",
              "updated_at",
              "closed_at",
              "casefile_written_at",
              "erased_at",
              "recurring_id",
              "recurring_on",
              "ilka_failed"
            ],
            "type": "object"
          }
        },
        "required": [
          "ticket",
          "events",
          "tasks",
          "runs"
        ],
        "type": "object"
      },
      "TicketPriority": {
        "enum": [
          "urgent",
          "high",
          "normal",
          "low"
        ],
        "type": "string"
      },
      "TicketStatus": {
        "enum": [
          "open",
          "waiting",
          "closed"
        ],
        "type": "string"
      },
      "WaysOutBody": {
        "additionalProperties": false,
        "properties": {
          "free_text": {
            "description": "The same for a medication not in the plan; absent when the software cannot tell right now",
            "enum": [
              "pvs",
              "agent",
              "manual"
            ],
            "type": "string"
          },
          "plan": {
            "description": "How a plan order reaches the practice software: its adapter writes it, Ilka enters it in its window, or staff do",
            "enum": [
              "pvs",
              "agent",
              "manual"
            ],
            "type": "string"
          }
        },
        "required": [
          "plan"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "apiToken": {
        "description": "Ein API-Zugang der Praxis (ath_…)",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Die Routen, die ein API-Zugang aufrufen darf. Anmeldung: Authorization: Bearer ath_…",
    "title": "atmOS Health API (API-Zugänge)",
    "version": "0.1.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/v1/actions": {
      "get": {
        "operationId": "list_actions",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ActionInfo"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List the practice-system actions with the JSON Schema of each one's input, for POST /actions/{name}/runs"
      }
    },
    "/v1/actions/{name}/options": {
      "get": {
        "operationId": "get_action_options",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Empty for a guest: book_appointment in a built-in calendar, order_freetext_medication can be drafted without a patient but cannot execute until linked; other actions return 409 patient_required",
            "explode": false,
            "in": "query",
            "name": "patient_ref",
            "schema": {
              "description": "Empty for a guest: book_appointment in a built-in calendar, order_freetext_medication can be drafted without a patient but cannot execute until linked; other actions return 409 patient_required",
              "type": "string"
            }
          },
          {
            "description": "The ticket the run will be on: only what may be booked or cancelled at its location",
            "explode": false,
            "in": "query",
            "name": "ticket_id",
            "schema": {
              "description": "The ticket the run will be on: only what may be booked or cancelled at its location",
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "JSON object of the input chosen so far, e.g. {\"reason_id\":\"impfung\",\"calendar_id\":\"kaya\"}. book_appointment also takes from and until (YYYY-MM-DD, at most six weeks) for the slots of those days; without them, the first five days with slots",
            "explode": false,
            "in": "query",
            "name": "partial",
            "schema": {
              "description": "JSON object of the input chosen so far, e.g. {\"reason_id\":\"impfung\",\"calendar_id\":\"kaya\"}. book_appointment also takes from and until (YYYY-MM-DD, at most six weeks) for the slots of those days; without them, the first five days with slots",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OptionsOutBody1"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List the choices for an action's input: orderable medications, visit reasons and free slots, upcoming appointments, or record text groups. 404 when the practice system lacks the action"
      }
    },
    "/v1/actions/{name}/runs": {
      "post": {
        "operationId": "propose_action_run",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "order_medication, order_freetext_medication, order_referral, book_appointment, cancel_appointment, write_casefile or file_document",
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "description": "order_medication, order_freetext_medication, order_referral, book_appointment, cancel_appointment, write_casefile or file_document",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProposeInputBody1"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionRun"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Propose a practice-system action for a ticket's patient (book_appointment in a built-in calendar also for a ticket without one, booking its contact): order_medication, order_freetext_medication, order_referral, book_appointment, cancel_appointment, write_casefile (the ticket's summary into the patient record) or file_document (one of the ticket's attachments into the patient record, where the practice system imports from a folder); each input's schema is in GET /actions. The practice's policy decides whether staff must approve it"
      }
    },
    "/v1/appointments": {
      "post": {
        "operationId": "create_appointment",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppointmentBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Row"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Book an appointment, with the further calendars its type needs, or block time (kind block: an absence such as vacation, one row over all its days) in a built-in calendar. Staff may book outside hours, breaks and windows, but not into a block or past capacity: 409 appointments_no_overlap. A block may cover booked appointments: they stay booked, to be moved"
      }
    },
    "/v1/appointments/{id}": {
      "patch": {
        "operationId": "update_appointment",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "updated_at as the caller last saw it: 409 appointment_changed if it changed since, so a drag never overwrites an edit made meanwhile",
            "explode": false,
            "in": "query",
            "name": "expected_updated_at",
            "schema": {
              "description": "updated_at as the caller last saw it: 409 appointment_changed if it changed since, so a drag never overwrites an edit made meanwhile",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "An appointment of a Terminkette: shift moves its later appointments by as much, keeping the gaps; only moves it alone though a gap breaks. Without it a broken gap is 409 chain_window",
            "explode": false,
            "in": "query",
            "name": "chain",
            "schema": {
              "description": "An appointment of a Terminkette: shift moves its later appointments by as much, keeping the gaps; only moves it alone though a gap breaks. Without it a broken gap is 409 chain_window",
              "enum": [
                "shift",
                "only"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppointmentBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Row"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Move, resize or change a built-in appointment; 409 appointments_no_overlap when the time is booked or blocked. An appointment of a Terminkette whose move breaks the gap to another of its appointments is 409 chain_window: then chain=shift moves its later ones by as much, chain=only moves it alone"
      }
    },
    "/v1/appointments/{id}/cancel": {
      "post": {
        "operationId": "cancel_appointment",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "An appointment of a Terminkette: cancel its other upcoming appointments too and stop its run",
            "explode": false,
            "in": "query",
            "name": "chain",
            "schema": {
              "description": "An appointment of a Terminkette: cancel its other upcoming appointments too and stop its run",
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Row"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Cancel a built-in appointment or blocked time; chain=true cancels the rest of its Terminkette too and stops its run"
      }
    },
    "/v1/calendar": {
      "get": {
        "operationId": "get_calendar",
        "parameters": [
          {
            "description": "First practice day, YYYY-MM-DD; default today",
            "explode": false,
            "in": "query",
            "name": "from",
            "schema": {
              "description": "First practice day, YYYY-MM-DD; default today",
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Last practice day; default a week from from",
            "explode": false,
            "in": "query",
            "name": "until",
            "schema": {
              "description": "Last practice day; default a week from from",
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Ask the practice system now instead of the cache",
            "explode": false,
            "in": "query",
            "name": "fresh",
            "schema": {
              "description": "Ask the practice system now instead of the cache",
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarOutBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "The practice's calendars visible to the caller for the practice days from to until (at most 6 weeks): where appointments live (source), each calendar with its location, appointment types, opening times, breaks and the holidays and closures of its location; with a practice system as the source also its appointments, read live. get_calendar_appointments lists what calendars hold, of either source"
      }
    },
    "/v1/calendar/appointments": {
      "get": {
        "operationId": "get_calendar_appointments",
        "parameters": [
          {
            "description": "Only these calendars; default every one the caller sees",
            "explode": false,
            "in": "query",
            "name": "calendar_ids",
            "schema": {
              "description": "Only these calendars; default every one the caller sees",
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          },
          {
            "description": "Only the calendars at this location",
            "explode": false,
            "in": "query",
            "name": "location_id",
            "schema": {
              "description": "Only the calendars at this location",
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "First practice day, YYYY-MM-DD; default today",
            "explode": false,
            "in": "query",
            "name": "from",
            "schema": {
              "description": "First practice day, YYYY-MM-DD; default today",
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Last practice day, at most 41 days after from; default a week from from",
            "explode": false,
            "in": "query",
            "name": "until",
            "schema": {
              "description": "Last practice day, at most 41 days after from; default a week from from",
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "The earliest this many",
            "explode": false,
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 100,
              "description": "The earliest this many",
              "format": "int64",
              "maximum": 500,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppointmentsOutBody1"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "What calendars hold on the practice days from to until (at most 6 weeks): each appointment, the part of one a room or device holds for it, and blocked time (absences, maintenance), earliest first, with its patient_ref or who comes, in the calendars named (or at a location, or all the caller sees). For a doctor's day, how full a location is, or who comes when; built-in calendars and a practice system's, read live"
      }
    },
    "/v1/calendar/slots": {
      "get": {
        "operationId": "get_slots",
        "parameters": [
          {
            "description": "The appointment type, or a practice system's visit reason",
            "explode": false,
            "in": "query",
            "name": "type_id",
            "required": true,
            "schema": {
              "description": "The appointment type, or a practice system's visit reason",
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Only these calendars; default every one the caller sees that takes the type",
            "explode": false,
            "in": "query",
            "name": "calendar_ids",
            "schema": {
              "description": "Only these calendars; default every one the caller sees that takes the type",
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          },
          {
            "description": "Only the calendars at this location",
            "explode": false,
            "in": "query",
            "name": "location_id",
            "schema": {
              "description": "Only the calendars at this location",
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "First practice day, YYYY-MM-DD; default today",
            "explode": false,
            "in": "query",
            "name": "from",
            "schema": {
              "description": "First practice day, YYYY-MM-DD; default today",
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Last practice day, at most 41 days after from; default 13 days after from",
            "explode": false,
            "in": "query",
            "name": "until",
            "schema": {
              "description": "Last practice day, at most 41 days after from; default 13 days after from",
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "The earliest this many",
            "explode": false,
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 100,
              "description": "The earliest this many",
              "format": "int64",
              "maximum": 500,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SlotsOutBody1"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "The next free appointments of a type, without a patient: in the calendars named (or at a location, or all the caller sees) that take it, from a practice day on; a built-in calendar's slot honours its hours, breaks, windows, absences, capacity, buffers and the type's needs, and names the room or device each need takes. A location with no calendar of a need's pool has no slots for the type: say why and look at other locations. A practice system's rules for a patient apply when the booking is proposed"
      }
    },
    "/v1/medication-orders/ways": {
      "get": {
        "operationId": "order_ways",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WaysOutBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "How the practice's software takes medication orders: by itself, by the agent on a practice computer, or by hand"
      }
    },
    "/v1/patients": {
      "get": {
        "operationId": "search_patients",
        "parameters": [
          {
            "description": "Last or first name (or its start), birth date (14.03.1951, 14.3.51, 14031951 or 1951-03-14), or a name and a birth date; at least 2 characters",
            "explode": false,
            "in": "query",
            "name": "q",
            "schema": {
              "description": "Last or first name (or its start), birth date (14.03.1951, 14.3.51, 14031951 or 1951-03-14), or a name and a birth date; at least 2 characters",
              "type": "string"
            }
          },
          {
            "description": "Instead of q: these patients by ref, in this order; a ref the practice system no longer has is left out",
            "explode": false,
            "in": "query",
            "name": "refs",
            "schema": {
              "description": "Instead of q: these patients by ref, in this order; a ref the practice system no longer has is left out",
              "items": {
                "type": "string"
              },
              "maxItems": 10,
              "type": "array"
            }
          },
          {
            "description": "At most this many, best first: those whose last or first name starts with q; total says how many matched",
            "explode": false,
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 20,
              "description": "At most this many, best first: those whose last or first name starts with q; total says how many matched",
              "format": "int64",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientsOutBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Find patients in the practice system by name or birthdate (TT.MM.JJJJ). It finds people; it does not list or count all patients (pvs_sql_query does, where offered)"
      }
    },
    "/v1/patients/by-phone": {
      "get": {
        "operationId": "find_patient_by_phone",
        "parameters": [
          {
            "explode": false,
            "in": "query",
            "name": "phone",
            "required": true,
            "schema": {
              "minLength": 3,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Patient"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Find the one patient with this phone number"
      }
    },
    "/v1/patients/{ref}": {
      "get": {
        "operationId": "get_patient",
        "parameters": [
          {
            "in": "path",
            "name": "ref",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Record"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get a patient's record: demographics, insurance and card read"
      }
    },
    "/v1/patients/{ref}/appointments": {
      "get": {
        "operationId": "get_appointments",
        "parameters": [
          {
            "in": "path",
            "name": "ref",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Only free slots for this visit reason, by id or name",
            "explode": false,
            "in": "query",
            "name": "reason",
            "schema": {
              "description": "Only free slots for this visit reason, by id or name",
              "type": "string"
            }
          },
          {
            "description": "The earliest this many free slots; 0 only the booked ones, without asking for free slots",
            "explode": false,
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 20,
              "description": "The earliest this many free slots; 0 only the booked ones, without asking for free slots",
              "format": "int64",
              "maximum": 100,
              "minimum": 0,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppointmentsOutBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get a patient's booked appointments and the earliest free slots, optionally for one visit reason; without one, what each calendar takes next. For more free times of a type use get_slots"
      }
    },
    "/v1/patients/{ref}/history": {
      "get": {
        "operationId": "patient_history",
        "parameters": [
          {
            "in": "path",
            "name": "ref",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Search the messages, call summaries, documents, notes and Kartei entries (German full text)",
            "explode": false,
            "in": "query",
            "name": "q",
            "schema": {
              "description": "Search the messages, call summaries, documents, notes and Kartei entries (German full text)",
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "description": "next_cursor of the previous page",
            "explode": false,
            "in": "query",
            "name": "cursor",
            "schema": {
              "description": "next_cursor of the previous page",
              "type": "string"
            }
          },
          {
            "explode": false,
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 40,
              "format": "int32",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HistoryOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Read or search a patient's case file, newest first: the messages, calls, documents, forms and internal notes of all their tickets, interleaved with the Kartei entries the practice wrote in the PVS (kind casefile: text group, text, author). q searches all of it; use it to find out what happened or to answer questions about the patient"
      }
    },
    "/v1/patients/{ref}/medications": {
      "get": {
        "operationId": "get_medication_plan",
        "parameters": [
          {
            "in": "path",
            "name": "ref",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Ask the practice system now instead of the cache, which may be minutes old: only right after the plan was changed or approved there, not on every read, as it costs a round trip to the practice",
            "explode": false,
            "in": "query",
            "name": "fresh",
            "schema": {
              "description": "Ask the practice system now instead of the cache, which may be minutes old: only right after the plan was changed or approved there, not on every read, as it costs a round trip to the practice",
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plan"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get a patient's medication plan and what can be ordered today"
      }
    },
    "/v1/tickets": {
      "get": {
        "operationId": "list_tickets",
        "parameters": [
          {
            "explode": false,
            "in": "query",
            "name": "status",
            "schema": {
              "items": {
                "$ref": "#/components/schemas/TicketStatus"
              },
              "type": "array"
            }
          },
          {
            "explode": false,
            "in": "query",
            "name": "location_ids",
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          },
          {
            "explode": false,
            "in": "query",
            "name": "team_ids",
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          },
          {
            "description": "me, none or member IDs; several match any of them",
            "explode": false,
            "in": "query",
            "name": "assignee",
            "schema": {
              "description": "me, none or member IDs; several match any of them",
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          },
          {
            "explode": false,
            "in": "query",
            "name": "category",
            "schema": {
              "items": {
                "$ref": "#/components/schemas/TicketCategory"
              },
              "type": "array"
            }
          },
          {
            "explode": false,
            "in": "query",
            "name": "priority",
            "schema": {
              "items": {
                "$ref": "#/components/schemas/TicketPriority"
              },
              "type": "array"
            }
          },
          {
            "explode": false,
            "in": "query",
            "name": "channel",
            "schema": {
              "items": {
                "$ref": "#/components/schemas/TicketChannel"
              },
              "type": "array"
            }
          },
          {
            "description": "Only tickets where the caller was mentioned",
            "explode": false,
            "in": "query",
            "name": "mentioned_me",
            "schema": {
              "description": "Only tickets where the caller was mentioned",
              "type": "boolean"
            }
          },
          {
            "description": "Only snoozed tickets; without it snoozed tickets are left out",
            "explode": false,
            "in": "query",
            "name": "snoozed",
            "schema": {
              "description": "Only snoozed tickets; without it snoozed tickets are left out",
              "type": "boolean"
            }
          },
          {
            "description": "Only tickets Ilka gave up (mark_ticket_failed)",
            "explode": false,
            "in": "query",
            "name": "ilka_failed",
            "schema": {
              "description": "Only tickets Ilka gave up (mark_ticket_failed)",
              "type": "boolean"
            }
          },
          {
            "description": "Only the tickets of this patient",
            "explode": false,
            "in": "query",
            "name": "patient_ref",
            "schema": {
              "description": "Only the tickets of this patient",
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "description": "Only tickets created or closed (period_on) in this window of days, in the practice's time zone",
            "explode": false,
            "in": "query",
            "name": "period",
            "schema": {
              "description": "Only tickets created or closed (period_on) in this window of days, in the practice's time zone",
              "enum": [
                "today",
                "yesterday",
                "this_week",
                "last_7_days"
              ],
              "type": "string"
            }
          },
          {
            "description": "What period, from and until apply to: when the ticket came in, or was closed. Default closed when status is only closed, else created",
            "explode": false,
            "in": "query",
            "name": "period_on",
            "schema": {
              "description": "What period, from and until apply to: when the ticket came in, or was closed. Default closed when status is only closed, else created",
              "enum": [
                "created",
                "closed"
              ],
              "type": "string"
            }
          },
          {
            "description": "With or without until: first day of the window",
            "explode": false,
            "in": "query",
            "name": "from",
            "schema": {
              "description": "With or without until: first day of the window",
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Last day of the window, included",
            "explode": false,
            "in": "query",
            "name": "until",
            "schema": {
              "description": "Last day of the window, included",
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "The inbox's scope: mine is assigned to the caller or one of their teams, unassigned has neither a person nor a team; all, or leaving it out, lists every ticket the other filters match",
            "explode": false,
            "in": "query",
            "name": "scope",
            "schema": {
              "description": "The inbox's scope: mine is assigned to the caller or one of their teams, unassigned has neither a person nor a team; all, or leaving it out, lists every ticket the other filters match",
              "enum": [
                "mine",
                "unassigned",
                "all"
              ],
              "type": "string"
            }
          },
          {
            "description": "Only tickets last changed before this time: the closed ones older than the live tickets shape",
            "explode": false,
            "in": "query",
            "name": "updated_before",
            "schema": {
              "description": "Only tickets last changed before this time: the closed ones older than the live tickets shape",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "A ticket number (T-2039), or full-text search (German stemming) over title, summary and the text of messages, documents and comments",
            "explode": false,
            "in": "query",
            "name": "q",
            "schema": {
              "description": "A ticket number (T-2039), or full-text search (German stemming) over title, summary and the text of messages, documents and comments",
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "description": "Apply this saved view's filter; filter parameters given here replace its fields",
            "explode": false,
            "in": "query",
            "name": "view_id",
            "schema": {
              "description": "Apply this saved view's filter; filter parameters given here replace its fields",
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "next_cursor of the previous page",
            "explode": false,
            "in": "query",
            "name": "cursor",
            "schema": {
              "description": "next_cursor of the previous page",
              "type": "string"
            }
          },
          {
            "explode": false,
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "format": "int32",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTicketsOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List or search tickets in the caller's locations, newest first. Filter like a saved view or apply one with view_id; q finds a ticket number (T-2039) or searches title, summary and message text"
      },
      "post": {
        "operationId": "create_ticket",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTicketInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "analysis_error": {
                      "type": "string"
                    },
                    "analysis_revision": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "assignee_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "casefile_written_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "category": {
                      "$ref": "#/components/schemas/TicketCategory"
                    },
                    "channel": {
                      "$ref": "#/components/schemas/TicketChannel"
                    },
                    "closed_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contact": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "created_by": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "erased_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "ilka_failed": {
                      "description": "Ilka gave it up, with why (mark_ticket_failed); null otherwise",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "input_revision": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "last_seq": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "location_id": {
                      "type": "string"
                    },
                    "number": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "patient_ref": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "person": {
                      "$ref": "#/components/schemas/Person"
                    },
                    "practice_id": {
                      "type": "string"
                    },
                    "priority": {
                      "$ref": "#/components/schemas/TicketPriority"
                    },
                    "recurring_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "recurring_on": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "snoozed_until": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "$ref": "#/components/schemas/TicketStatus"
                    },
                    "summary": {
                      "type": "string"
                    },
                    "team_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "thread_key": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "triaging": {
                      "type": "boolean"
                    },
                    "unread": {
                      "type": "boolean"
                    },
                    "updated_at": {
                      "format": "date-time",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "practice_id",
                    "number",
                    "location_id",
                    "team_id",
                    "assignee_id",
                    "created_by",
                    "status",
                    "priority",
                    "category",
                    "channel",
                    "contact",
                    "person",
                    "patient_ref",
                    "thread_key",
                    "unread",
                    "triaging",
                    "input_revision",
                    "analysis_revision",
                    "analysis_error",
                    "title",
                    "summary",
                    "snoozed_until",
                    "last_seq",
                    "created_at",
                    "updated_at",
                    "closed_at",
                    "casefile_written_at",
                    "erased_at",
                    "recurring_id",
                    "recurring_on",
                    "ilka_failed"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Create a ticket by hand: a call taken, someone at the counter or an internal to-do, with its status, priority, category, team and assignee"
      }
    },
    "/v1/tickets/{id}": {
      "get": {
        "operationId": "get_ticket",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TicketDetailOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Read a ticket by its id (not its number: list_tickets q=T-2039 finds that) with its full activity (events, oldest first), its subtasks and the caller's mention"
      },
      "patch": {
        "operationId": "update_ticket",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EditTicketBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "analysis_error": {
                      "type": "string"
                    },
                    "analysis_revision": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "assignee_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "casefile_written_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "category": {
                      "$ref": "#/components/schemas/TicketCategory"
                    },
                    "channel": {
                      "$ref": "#/components/schemas/TicketChannel"
                    },
                    "closed_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contact": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "created_by": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "erased_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "ilka_failed": {
                      "description": "Ilka gave it up, with why (mark_ticket_failed); null otherwise",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "input_revision": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "last_seq": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "location_id": {
                      "type": "string"
                    },
                    "number": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "patient_ref": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "person": {
                      "$ref": "#/components/schemas/Person"
                    },
                    "practice_id": {
                      "type": "string"
                    },
                    "priority": {
                      "$ref": "#/components/schemas/TicketPriority"
                    },
                    "recurring_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "recurring_on": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "snoozed_until": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "$ref": "#/components/schemas/TicketStatus"
                    },
                    "summary": {
                      "type": "string"
                    },
                    "team_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "thread_key": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "triaging": {
                      "type": "boolean"
                    },
                    "unread": {
                      "type": "boolean"
                    },
                    "updated_at": {
                      "format": "date-time",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "practice_id",
                    "number",
                    "location_id",
                    "team_id",
                    "assignee_id",
                    "created_by",
                    "status",
                    "priority",
                    "category",
                    "channel",
                    "contact",
                    "person",
                    "patient_ref",
                    "thread_key",
                    "unread",
                    "triaging",
                    "input_revision",
                    "analysis_revision",
                    "analysis_error",
                    "title",
                    "summary",
                    "snoozed_until",
                    "last_seq",
                    "created_at",
                    "updated_at",
                    "closed_at",
                    "casefile_written_at",
                    "erased_at",
                    "recurring_id",
                    "recurring_on",
                    "ilka_failed"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Change a ticket's title, summary, status, priority, category, location, team, assignee or unread marker"
      }
    },
    "/v1/tickets/{id}/comments": {
      "post": {
        "operationId": "add_comment",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddCommentInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeqOutputBody1"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Add an internal comment to a ticket, optionally mentioning members"
      }
    },
    "/v1/tickets/{id}/replies": {
      "post": {
        "operationId": "reply_ticket",
        "parameters": [
          {
            "in": "query",
            "name": "expected_seq",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Reply"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SentOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Reply to a ticket's patient on its channel (email, SMS, chat, portal) or another of theirs"
      }
    }
  },
  "security": [
    {
      "apiToken": []
    }
  ],
  "servers": [
    {
      "url": "https://app.atmos-health.de"
    }
  ],
  "x-electric-shapes": {
    "$ref": "#/components/schemas/Shapes"
  }
}
