<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="http://ontariohealth.ca/fhir/pubsub/StructureDefinition/profile-Subscription" />
  <name value="OntarioBackportSubscription" />
  <status value="draft" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Subscription" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Subscription" />
  <derivation value="constraint" />
  <differential>
    <element id="Subscription.extension">
      <path value="Subscription.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <ordered value="false" />
        <rules value="open" />
      </slicing>
      <short value="Extension" />
      <definition value="An Extension" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="DomainResource.extension" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Extension" />
      </type>
      <constraint>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <expression value="hasValue() or (children().count() &gt; id.count())" />
        <xpath value="@value|f:*|h:div" />
        <source value="http://hl7.org/fhir/StructureDefinition/Element" />
      </constraint>
      <constraint>
        <key value="ext-1" />
        <severity value="error" />
        <human value="Must have either extensions or value[x], not both" />
        <expression value="extension.exists() != value.exists()" />
        <xpath value="exists(f:extension)!=exists(f:*[starts-with(local-name(.), &quot;value&quot;)])" />
        <source value="http://hl7.org/fhir/StructureDefinition/Extension" />
      </constraint>
      <mustSupport value="true" />
      <isModifier value="false" />
      <isSummary value="false" />
    </element>
    <element id="Subscription.extension:managingEntity">
      <path value="Subscription.extension" />
      <sliceName value="managingEntity" />
      <short value="Entity managing the subscription (Device by identifier)" />
      <definition value="The Device (e.g., EMR system) responsible for managing the subscription, referenced by its logical identifier. Backported from R5 Subscription.managingEntity." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://ontariohealth.ca/fhir/ehr/StructureDefinition/ext-subscriptionManagingEntity" />
      </type>
      <mustSupport value="true" />
      <isModifier value="false" />
    </element>
    <element id="Subscription.criteria">
      <path value="Subscription.criteria" />
      <mustSupport value="true" />
    </element>
    <element id="Subscription.criteria.extension:filterCriteria">
      <path value="Subscription.criteria.extension" />
      <sliceName value="filterCriteria" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-filter-criteria" />
      </type>
      <mustSupport value="true" />
      <isModifier value="false" />
    </element>
    <element id="Subscription.channel.extension:notificationRetryPeriod">
      <path value="Subscription.channel.extension" />
      <sliceName value="notificationRetryPeriod" />
      <type>
        <code value="Extension" />
        <profile value="http://ontariohealth.ca/fhir/pubsub/StructureDefinition/ext-SubscriptionNotificationRetryPeriod" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Subscription.channel.extension:heartbeatPeriod">
      <path value="Subscription.channel.extension" />
      <sliceName value="heartbeatPeriod" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-heartbeat-period" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Subscription.channel.extension:timeout">
      <path value="Subscription.channel.extension" />
      <sliceName value="timeout" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-timeout" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Subscription.channel.extension:maxCount">
      <path value="Subscription.channel.extension" />
      <sliceName value="maxCount" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-max-count" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Subscription.channel.type.extension:customChannelType">
      <path value="Subscription.channel.type.extension" />
      <sliceName value="customChannelType" />
      <short value="Extended channel type for notifications" />
      <definition value="The type of channel to send notifications on." />
      <comment value="This extension allows for the use of additional channel types that were not defined in the FHIR R4 subscription definition." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-channel-type" />
      </type>
      <mustSupport value="true" />
      <isSummary value="true" />
    </element>
    <element id="Subscription.channel.payload">
      <path value="Subscription.channel.payload" />
      <min value="1" />
    </element>
    <element id="Subscription.channel.payload.extension">
      <path value="Subscription.channel.payload.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <ordered value="false" />
        <rules value="open" />
      </slicing>
      <min value="1" />
    </element>
    <element id="Subscription.channel.payload.extension:content">
      <path value="Subscription.channel.payload.extension" />
      <sliceName value="content" />
      <short value="Notification content level" />
      <definition value="How much of the resource content to deliver in the notification payload. The choices are an empty payload, only the resource id, or the full resource content." />
      <comment value="Sending the payload has obvious security implications. The server is responsible for ensuring that the content is appropriately secured." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-payload-content" />
      </type>
      <mustSupport value="true" />
      <isSummary value="true" />
    </element>
    <element id="Subscription.channel.header">
      <path value="Subscription.channel.header" />
      <definition value="Use to specify additional information that will be included inside the notification payload when the notification is sent. Each entry consists of a key-value pair. This should support sending client certificates and client keys with validation to determine if it is the certificate itself or just the name." />
      <comment value="This can convey additional information to the recipient and/or meet security requirements; for example, support of multiple headers in the outgoing notifications for rest-hook type subscriptions." />
    </element>
  </differential>
</StructureDefinition>