{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/elation-health/main/json-schema/elation-health-thread-message-schema.json",
  "title": "ThreadMessage",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/elation-health-thread-messages-api-openapi.yml#/components/schemas/ThreadMessage",
  "properties": {
    "body": {
      "description": "The actual message body.",
      "type": "string"
    },
    "id": {
      "readOnly": true,
      "type": "integer"
    },
    "patient": {
      "description": "The patient id.",
      "format": "int64",
      "readOnly": true,
      "type": "integer"
    },
    "practice": {
      "description": "The practice id.",
      "format": "int64",
      "readOnly": true,
      "type": "integer"
    },
    "send_date": {
      "description": "The date of when the message was sent.",
      "format": "date-time",
      "type": "string"
    },
    "sender": {
      "description": "The id of who sent the message.",
      "type": "integer"
    },
    "thread": {
      "description": "The message thread id.",
      "format": "int64",
      "type": "integer"
    },
    "to_document": {
      "$ref": "#/$defs/Document"
    }
  },
  "required": [
    "body",
    "send_date",
    "sender"
  ],
  "type": "object",
  "$defs": {
    "Document": {
      "properties": {
        "authoring_practice": {
          "format": "int64",
          "type": "integer"
        },
        "chart_date": {
          "description": "The creation date of the patient chart.",
          "format": "date-time",
          "type": "string"
        },
        "created_date": {
          "description": "The creation date of the document.",
          "format": "date-time",
          "readOnly": true,
          "type": [
            "string",
            "null"
          ]
        },
        "deleted_date": {
          "description": "The deleted date of the document.",
          "format": "date-time",
          "readOnly": true,
          "type": [
            "string",
            "null"
          ]
        },
        "document_date": {
          "description": "The date of the document. In most cases it's the same as the creation date. For some documents, like visit notes, it's the date of the visit note.",
          "format": "date-time",
          "type": "string"
        },
        "document_type": {
          "readOnly": true,
          "type": [
            "integer",
            "null"
          ]
        },
        "id": {
          "format": "int64",
          "type": "integer"
        },
        "last_modified": {
          "format": "date-time",
          "type": "string"
        },
        "patient": {
          "format": "int64",
          "type": "integer"
        },
        "sign_date": {
          "description": "The date of when the document was signed (if signed).",
          "format": "date-time",
          "readOnly": true,
          "type": [
            "string",
            "null"
          ]
        },
        "signed_by": {
          "description": "The id of whoever signed the document (if signed).",
          "readOnly": true,
          "type": "integer"
        }
      },
      "required": [
        "authoring_practice",
        "chart_date",
        "document_date",
        "id",
        "patient"
      ],
      "type": "object"
    }
  }
}