<?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 Mon, Mar 9, 2026 22:30+0000 for FHIR v6.0.0-ballot4 

  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="SubscriptionStatus" type="SubscriptionStatus">
    <xs:annotation>
      <xs:documentation xml:lang="en">The SubscriptionStatus resource describes the state of a Subscription during notifications.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="SubscriptionStatus">
    <xs:annotation>
      <xs:documentation xml:lang="en">The SubscriptionStatus resource describes the state of a Subscription during notifications.</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="status" minOccurs="0" maxOccurs="1" type="SubscriptionStatusCodes">
            <xs:annotation>
              <xs:documentation xml:lang="en">The status of the subscription, which marks the server state for managing the subscription.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="SubscriptionNotificationType">
            <xs:annotation>
              <xs:documentation xml:lang="en">The type of event being conveyed with this notification.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="eventsSinceSubscriptionStart" minOccurs="0" maxOccurs="1" type="integer64">
            <xs:annotation>
              <xs:documentation xml:lang="en">The total number of actual events which have been generated since the Subscription was created (inclusive of this notification) - regardless of how many have been successfully communicated.  This number is NOT incremented for handshake and heartbeat notifications.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="notificationEvent" type="SubscriptionStatus.NotificationEvent" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">Detailed information about events relevant to this subscription notification.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subscription" minOccurs="1" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">The reference to the Subscription which generated this notification.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="topic" minOccurs="0" maxOccurs="1" type="canonical">
            <xs:annotation>
              <xs:documentation xml:lang="en">The reference to the SubscriptionTopic for the Subscription which generated this notification.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="error" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">A record of errors that occurred when the server processed a notification.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="SubscriptionStatus.NotificationEvent">
    <xs:annotation>
      <xs:documentation xml:lang="en">The SubscriptionStatus resource describes the state of a Subscription during notifications.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="eventNumber" minOccurs="1" maxOccurs="1" type="integer64">
            <xs:annotation>
              <xs:documentation xml:lang="en">Either the sequential number of this event in this subscription context or a relative event number for this notification.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="triggerEvent" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">If present, one or more event codes specifying the events which triggered this notification.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="timestamp" minOccurs="0" maxOccurs="1" type="instant">
            <xs:annotation>
              <xs:documentation xml:lang="en">The actual time this event occurred on the server.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="focus" minOccurs="0" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">The focus of this event. While this will usually be a reference to the focus resource of the event, it MAY contain a reference to a non-FHIR object.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="additionalContext" minOccurs="0" maxOccurs="unbounded" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Additional context information for this event. Generally, this will contain references to related resources included with the event (e.g., the Patient relevant to an Encounter), however it MAY refer to non-FHIR objects.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="relatedQuery" type="SubscriptionStatus.RelatedQuery" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">Queries and codes that could be included with notifications of this shape. Servers MAY include these queries if supported and desired in the workflow.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="authorizationHint" type="SubscriptionStatus.AuthorizationHint" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">Authorization context information and value (e.g., token).</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="SubscriptionStatus.RelatedQuery">
    <xs:annotation>
      <xs:documentation xml:lang="en">The SubscriptionStatus resource describes the state of a Subscription during notifications.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="queryType" minOccurs="0" maxOccurs="1" type="Coding">
            <xs:annotation>
              <xs:documentation xml:lang="en">Coded value(s) used to describe the type of information that evaluating this query will provide. Subscribers can use the values to ensure the data they request are relevant and necessary for their use.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="query" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">Query a subscriber can use to retrieve additional information. The exact contents of the query MAY depend on the value of the `queryType`, however this SHOULD be a query suitable for use as an HTTP GET request (either fully-qualified or partial).</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="SubscriptionStatus.AuthorizationHint">
    <xs:annotation>
      <xs:documentation xml:lang="en">The SubscriptionStatus resource describes the state of a Subscription during notifications.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="authorizationType" minOccurs="1" maxOccurs="1" type="Coding">
            <xs:annotation>
              <xs:documentation xml:lang="en">Used by clients to determine what kind of authorization hint is being suggested by the sender.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="value" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">A value related to the authorization (e.g., a token).</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SubscriptionNotificationTypeEnum">
    <xs:restriction base="code-primitive">
      <xs:enumeration value="handshake">
        <xs:annotation>
          <xs:documentation xml:lang="en">Handshake</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="heartbeat">
        <xs:annotation>
          <xs:documentation xml:lang="en">Heartbeat</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="event-notification">
        <xs:annotation>
          <xs:documentation xml:lang="en">Event Notification</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="query-status">
        <xs:annotation>
          <xs:documentation xml:lang="en">Query Status</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="query-event">
        <xs:annotation>
          <xs:documentation xml:lang="en">Query Event</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SubscriptionNotificationType">
    <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="SubscriptionNotificationTypeEnum" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>
