<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="Mxx-HealthHub-PatientModuleSubscription" />
  <url value="https://fhir.medatixx.de/HealthHub/StructureDefinition/Mxx_HealthHub_PatientModuleSubscription" />
  <version value="1.5.0" />
  <name value="Mxx_HealthHub_PatientModuleSubscription" />
  <title value="Mxx_HealthHub_PatientModuleSubscription" />
  <status value="active" />
  <publisher value="medatixx GmbH &amp; Co. KG" />
  <description value="Subscription profile for the Patient module of the medatixx-HealthHub. Restricts the allowed criteria to the defined PatientSubscriptionTopics and enforces REST hook delivery with an HTTPS endpoint, FHIR+JSON payload and at least one Authorization header. For the topic patient-opened, the extension Mxx_HealthHub_PatientModuleSubscriptionWorkstationFilter MUST additionally be set on Subscription.criteria (1..1); if it is missing, the server rejects the subscription with 400 Bad Request." />
  <copyright value="medatixx GmbH &amp; Co. KG" />
  <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.contact">
      <path value="Subscription.contact" />
      <max value="0" />
    </element>
    <element id="Subscription.criteria">
      <path value="Subscription.criteria" />
      <definition value="The topic to subscribe to. Must be one of the codes from Mxx_HealthHub_VS_PatientSubscriptionTopic. For the topic patient-opened the extension Mxx_HealthHub_PatientModuleSubscriptionWorkstationFilter is mandatory (1..1) and must carry at least one workstationId." />
      <binding>
        <strength value="required" />
        <valueSet value="https://fhir.medatixx.de/HealthHub/ValueSet/Mxx_HealthHub_VS_PatientSubscriptionTopic" />
      </binding>
    </element>
    <element id="Subscription.criteria.extension">
      <path value="Subscription.criteria.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Subscription.criteria.extension:workstationFilter">
      <path value="Subscription.criteria.extension" />
      <sliceName value="workstationFilter" />
      <short value="Workstation-Filter fuer patient-opened (Pflicht bei diesem Topic)" />
      <definition value="Schraenkt patient-opened-Benachrichtigungen auf eine Liste von PVS-Arbeitsplatz-IDs ein. Bei criteria = patient-opened ist diese Extension 1..1 Pflicht. Eine Subscription ohne diese Extension wird mit 400 Bad Request abgewiesen." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.medatixx.de/HealthHub/StructureDefinition/Mxx_HealthHub_PatientModuleSubscriptionWorkstationFilter" />
      </type>
    </element>
    <element id="Subscription.channel.type">
      <path value="Subscription.channel.type" />
      <fixedCode value="rest-hook" />
    </element>
    <element id="Subscription.channel.endpoint">
      <path value="Subscription.channel.endpoint" />
      <definition value="The url that describes the actual end-point to send messages to. Must use HTTPS as protocol." />
      <min value="1" />
    </element>
    <element id="Subscription.channel.payload">
      <path value="Subscription.channel.payload" />
      <min value="1" />
      <fixedCode value="application/fhir+json" />
    </element>
    <element id="Subscription.channel.header">
      <path value="Subscription.channel.header" />
      <definition value="Additional headers / information to send as part of the notification. At least an Authorization-Header must be present." />
      <min value="1" />
    </element>
  </differential>
</StructureDefinition>