<!-- 
  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 Wed, Apr 19, 2017 07:44+1000 for FHIR v3.0.1 

  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="MessageDefinition" type="MessageDefinition">
    <xs:annotation>
      <xs:documentation xml:lang="en">Defines the characteristics of a message that can be shared between systems, including the type of event that initiates the message, the content to be transmitted and what response(s), if any, are permitted.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="MessageDefinition">
    <xs:annotation>
      <xs:documentation xml:lang="en">Defines the characteristics of a message that can be shared between systems, including the type of event that initiates the message, the content to be transmitted and what response(s), if any, are permitted.</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="DomainResource">
        <xs:sequence>
          <xs:element name="url" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation xml:lang="en">An absolute URI that is used to identify this message definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this message definition is (or will be) published. The URL SHOULD include the major version of the message definition. For more information see [Technical and Business Versions](resource.html#versions).</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="identifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation xml:lang="en">A formal identifier that is used to identify this message definition when it is represented in other formats, or referenced in a specification, model, design or an instance.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">The identifier that is used to identify this version of the message definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the message definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">A natural language name identifying the message definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="title" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">A short, descriptive, user-friendly title for the message definition.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="PublicationStatus">
            <xs:annotation>
              <xs:documentation xml:lang="en">The status of this message definition. Enables tracking the life-cycle of the content.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="experimental" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation xml:lang="en">A boolean value to indicate that this message definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="1" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation xml:lang="en">The date  (and optionally time) when the message definition was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the message definition changes.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="publisher" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">The name of the individual or organization that published the message definition.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="contact" minOccurs="0" maxOccurs="unbounded" type="ContactDetail">
            <xs:annotation>
              <xs:documentation xml:lang="en">Contact details to assist a user in finding and communicating with the publisher.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="markdown">
            <xs:annotation>
              <xs:documentation xml:lang="en">A free text natural language description of the message definition from a consumer's perspective.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="useContext" minOccurs="0" maxOccurs="unbounded" type="UsageContext">
            <xs:annotation>
              <xs:documentation xml:lang="en">The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate message definition instances.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="jurisdiction" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">A legal or geographic region in which the message definition is intended to be used.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="purpose" minOccurs="0" maxOccurs="1" type="markdown">
            <xs:annotation>
              <xs:documentation xml:lang="en">Explaination of why this message definition is needed and why it has been designed as it has.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="copyright" minOccurs="0" maxOccurs="1" type="markdown">
            <xs:annotation>
              <xs:documentation xml:lang="en">A copyright statement relating to the message definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the message definition.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="base" minOccurs="0" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">The MessageDefinition that is the basis for the contents of this resource.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="parent" minOccurs="0" maxOccurs="unbounded" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Identifies a protocol or workflow that this MessageDefinition represents a step in.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="replaces" minOccurs="0" maxOccurs="unbounded" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">A MessageDefinition that is superseded by this definition.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="event" minOccurs="1" maxOccurs="1" type="Coding">
            <xs:annotation>
              <xs:documentation xml:lang="en">A coded identifier of a supported messaging event.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="category" minOccurs="0" maxOccurs="1" type="MessageSignificanceCategory">
            <xs:annotation>
              <xs:documentation xml:lang="en">The impact of the content of the message.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="focus" type="MessageDefinition.Focus" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">Identifies the resource (or resources) that are being addressed by the event.  For example, the Encounter for an admit message or two Account records for a merge.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="responseRequired" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation xml:lang="en">Indicates whether a response is required for this message.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="allowedResponse" type="MessageDefinition.AllowedResponse" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">Indicates what types of messages may be sent as an application-level response to this message.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="MessageDefinition.Focus">
    <xs:annotation>
      <xs:documentation xml:lang="en">Defines the characteristics of a message that can be shared between systems, including the type of event that initiates the message, the content to be transmitted and what response(s), if any, are permitted.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="ResourceType">
            <xs:annotation>
              <xs:documentation xml:lang="en">The kind of resource that must be the focus for this message.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="profile" minOccurs="0" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">A profile that reflects constraints for the focal resource (and potentially for related resources).</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="min" minOccurs="0" maxOccurs="1" type="unsignedInt">
            <xs:annotation>
              <xs:documentation xml:lang="en">Identifies the minimum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="max" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">Identifies the maximum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="MessageDefinition.AllowedResponse">
    <xs:annotation>
      <xs:documentation xml:lang="en">Defines the characteristics of a message that can be shared between systems, including the type of event that initiates the message, the content to be transmitted and what response(s), if any, are permitted.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="message" minOccurs="1" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">A reference to the message definition that must be adhered to by this supported response.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="situation" minOccurs="0" maxOccurs="1" type="markdown">
            <xs:annotation>
              <xs:documentation xml:lang="en">Provides a description of the circumstances in which this response should be used (as opposed to one of the alternative responses).</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>