{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/canvas-medical/main/json-schema/canvas-medical-bundle-schema.json",
  "title": "Bundle",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/canvas-medical-appointment-api-openapi.yml#/components/schemas/Bundle",
  "type": "object",
  "properties": {
    "resourceType": {
      "type": "string",
      "default": "Bundle"
    },
    "id": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "enum": [
        "document",
        "message",
        "transaction",
        "transaction-response",
        "batch",
        "batch-response",
        "history",
        "searchset",
        "collection",
        "subscription-notification"
      ]
    },
    "total": {
      "type": "integer"
    },
    "link": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "relation": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        }
      }
    },
    "entry": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "fullUrl": {
            "type": "string"
          },
          "resource": {
            "$ref": "#/$defs/FHIRResource"
          },
          "search": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "match",
                  "include",
                  "outcome"
                ]
              }
            }
          }
        }
      }
    }
  },
  "$defs": {
    "Coding": {
      "type": "object",
      "properties": {
        "system": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "code": {
          "type": "string"
        },
        "display": {
          "type": "string"
        },
        "userSelected": {
          "type": "boolean"
        }
      }
    },
    "FHIRResource": {
      "type": "object",
      "description": "Base FHIR R4 resource properties",
      "properties": {
        "resourceType": {
          "type": "string",
          "description": "FHIR resource type name"
        },
        "id": {
          "type": "string",
          "description": "Logical id of this artifact"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        },
        "text": {
          "$ref": "#/$defs/Narrative"
        }
      }
    },
    "Meta": {
      "type": "object",
      "properties": {
        "versionId": {
          "type": "string"
        },
        "lastUpdated": {
          "type": "string",
          "format": "date-time"
        },
        "source": {
          "type": "string"
        },
        "profile": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "tag": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Coding"
          }
        }
      }
    },
    "Narrative": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "generated",
            "extensions",
            "additional",
            "empty"
          ]
        },
        "div": {
          "type": "string"
        }
      }
    }
  }
}