<?xml version="1.0" encoding="UTF-8"?>
<!-- 
 * #%L
 * org.hl7.fhir.r5
 * %%
 * Copyright (C) 2014 - 2019 Health Level 7
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

/*
  Copyright (c) 2011+, HL7, Inc.
  All rights reserved.
  
  Redistribution and use in source and binary forms, with or without modification, 
  are permitted provided that the following conditions are met:
  
   * Redistributions of source code must retain the above copyright notice, this 
     list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright notice, 
     this list of conditions and the following disclaimer in the documentation 
     and/or other materials provided with the distribution.
   * Neither the name of HL7 nor the names of its contributors may be used to 
     endorse or promote products derived from this software without specific 
     prior written permission.
  
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
  POSSIBILITY OF SUCH DAMAGE.
  

  Generated on Sat, May 28, 2022 12:47+1000 for FHIR v4.3.0 

  Note: the schemas &amp; schematrons do not contain all of the rules about what makes resources
  valid. Implementers will still need to be familiar with the content of the specification and with
  any profiles that apply to the resources in order to make a conformant implementation.

-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://hl7.org/fhir" xmlns:xhtml="http://www.w3.org/1999/xhtml" targetNamespace="http://hl7.org/fhir" elementFormDefault="qualified" version="1.0">
  <xs:include schemaLocation="fhir-base.xsd"/>
  <xs:element name="Bundle" type="Bundle">
    <xs:annotation>
      <xs:documentation xml:lang="en">A container for a collection of resources.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Bundle">
    <xs:annotation>
      <xs:documentation xml:lang="en">A container for a collection of resources.</xs:documentation>
      <xs:documentation xml:lang="en">If the element is present, it must have either a @value, an @id, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Resource">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation xml:lang="en">A persistent identifier for the bundle that won't change as a bundle is copied from server to server.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="BundleType">
            <xs:annotation>
              <xs:documentation xml:lang="en">Indicates the purpose of this bundle - how it is intended to be used.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="timestamp" minOccurs="0" maxOccurs="1" type="instant">
            <xs:annotation>
              <xs:documentation xml:lang="en">The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="total" minOccurs="0" maxOccurs="1" type="unsignedInt">
            <xs:annotation>
              <xs:documentation xml:lang="en">If a set of search matches, this is the total number of entries of type 'match' across all pages in the search.  It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of entries in the Bundle.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="link" type="Bundle.Link" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">A series of links that provide context to this bundle.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="entry" type="Bundle.Entry" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">An entry in a bundle resource - will either contain a resource or information about a resource (transactions and history only).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="signature" minOccurs="0" maxOccurs="1" type="Signature">
            <xs:annotation>
              <xs:documentation xml:lang="en">Digital Signature - base64 encoded. XML-DSig or a JWT.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Bundle.Link">
    <xs:annotation>
      <xs:documentation xml:lang="en">A container for a collection of resources.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="relation" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="url" minOccurs="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation xml:lang="en">The reference details for the link.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Bundle.Entry">
    <xs:annotation>
      <xs:documentation xml:lang="en">A container for a collection of resources.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="link" type="Bundle.Link" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">A series of links that provide context to this entry.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="fullUrl" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation xml:lang="en">The Absolute URL for the resource.  The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: 
* fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle)
* Results from operations might involve resources that are not identified.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="resource" minOccurs="0" maxOccurs="1" type="ResourceContainer">
            <xs:annotation>
              <xs:documentation xml:lang="en">The Resource for the entry. The purpose/meaning of the resource is determined by the Bundle.type.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="search" type="Bundle.Search" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation xml:lang="en">Information about the search process that lead to the creation of this entry.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="request" type="Bundle.Request" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation xml:lang="en">Additional information about how this entry should be processed as part of a transaction or batch.  For history, it shows how the entry was processed to create the version contained in the entry.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="response" type="Bundle.Response" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation xml:lang="en">Indicates the results of processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Bundle.Search">
    <xs:annotation>
      <xs:documentation xml:lang="en">A container for a collection of resources.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="mode" minOccurs="0" maxOccurs="1" type="SearchEntryMode">
            <xs:annotation>
              <xs:documentation xml:lang="en">Why this entry is in the result set - whether it's included as a match or because of an _include requirement, or to convey information or warning information about the search process.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="score" minOccurs="0" maxOccurs="1" type="decimal">
            <xs:annotation>
              <xs:documentation xml:lang="en">When searching, the server's search ranking score for the entry.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Bundle.Request">
    <xs:annotation>
      <xs:documentation xml:lang="en">A container for a collection of resources.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="method" minOccurs="1" maxOccurs="1" type="HTTPVerb">
            <xs:annotation>
              <xs:documentation xml:lang="en">In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="url" minOccurs="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation xml:lang="en">The URL for this entry, relative to the root (the address to which the request is posted).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="ifNoneMatch" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">If the ETag values match, return a 304 Not Modified status. See the API documentation for [&quot;Conditional Read&quot;](http.html#cread).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="ifModifiedSince" minOccurs="0" maxOccurs="1" type="instant">
            <xs:annotation>
              <xs:documentation xml:lang="en">Only perform the operation if the last updated date matches. See the API documentation for [&quot;Conditional Read&quot;](http.html#cread).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="ifMatch" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">Only perform the operation if the Etag value matches. For more information, see the API section [&quot;Managing Resource Contention&quot;](http.html#concurrency).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="ifNoneExist" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for [&quot;Conditional Create&quot;](http.html#ccreate). This is just the query portion of the URL - what follows the &quot;?&quot; (not including the &quot;?&quot;).</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Bundle.Response">
    <xs:annotation>
      <xs:documentation xml:lang="en">A container for a collection of resources.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="location" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation xml:lang="en">The location header created by processing this operation, populated if the operation returns a location.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="etag" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">The Etag for the resource, if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="lastModified" minOccurs="0" maxOccurs="1" type="instant">
            <xs:annotation>
              <xs:documentation xml:lang="en">The date/time that the resource was modified on the server.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="outcome" minOccurs="0" maxOccurs="1" type="ResourceContainer">
            <xs:annotation>
              <xs:documentation xml:lang="en">An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="HTTPVerbEnum">
    <xs:restriction base="code-primitive">
      <xs:enumeration value="GET">
        <xs:annotation>
          <xs:documentation xml:lang="en">GET</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="HEAD">
        <xs:annotation>
          <xs:documentation xml:lang="en">HEAD</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="POST">
        <xs:annotation>
          <xs:documentation xml:lang="en">POST</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="PUT">
        <xs:annotation>
          <xs:documentation xml:lang="en">PUT</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="DELETE">
        <xs:annotation>
          <xs:documentation xml:lang="en">DELETE</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="PATCH">
        <xs:annotation>
          <xs:documentation xml:lang="en">PATCH</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="HTTPVerb">
    <xs:annotation>
      <xs:documentation xml:lang="en"></xs:documentation>
      <xs:documentation xml:lang="en">If the element is present, it must have either a @value, an @id, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:attribute name="value" type="HTTPVerbEnum" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="BundleTypeEnum">
    <xs:restriction base="code-primitive">
      <xs:enumeration value="document">
        <xs:annotation>
          <xs:documentation xml:lang="en">Document</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="message">
        <xs:annotation>
          <xs:documentation xml:lang="en">Message</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="transaction">
        <xs:annotation>
          <xs:documentation xml:lang="en">Transaction</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="transaction-response">
        <xs:annotation>
          <xs:documentation xml:lang="en">Transaction Response</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="batch">
        <xs:annotation>
          <xs:documentation xml:lang="en">Batch</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="batch-response">
        <xs:annotation>
          <xs:documentation xml:lang="en">Batch Response</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="history">
        <xs:annotation>
          <xs:documentation xml:lang="en">History List</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="searchset">
        <xs:annotation>
          <xs:documentation xml:lang="en">Search Results</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="collection">
        <xs:annotation>
          <xs:documentation xml:lang="en">Collection</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="BundleType">
    <xs:annotation>
      <xs:documentation xml:lang="en"></xs:documentation>
      <xs:documentation xml:lang="en">If the element is present, it must have either a @value, an @id, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:attribute name="value" type="BundleTypeEnum" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SearchEntryModeEnum">
    <xs:restriction base="code-primitive">
      <xs:enumeration value="match">
        <xs:annotation>
          <xs:documentation xml:lang="en">Match</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="include">
        <xs:annotation>
          <xs:documentation xml:lang="en">Include</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="outcome">
        <xs:annotation>
          <xs:documentation xml:lang="en">Outcome</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SearchEntryMode">
    <xs:annotation>
      <xs:documentation xml:lang="en"></xs:documentation>
      <xs:documentation xml:lang="en">If the element is present, it must have either a @value, an @id, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:attribute name="value" type="SearchEntryModeEnum" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>
