<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="England-RequestGroup" />
  <url value="https://fhir.nhs.uk/StructureDefinition/England-RequestGroup" />
  <version value="0.1.0" />
  <name value="EnglandRequestGroup" />
  <title value="England RequestGroup" />
  <status value="draft" />
  <date value="2025-04-03" />
  <publisher value="NHS England" />
  <contact>
    <name value="NHS England" />
    <telecom>
      <system value="email" />
      <value value="interoperabilityteam@nhs.net" />
      <use value="work" />
      <rank value="1" />
    </telecom>
  </contact>
  <description value="This profile defines the NHS England constraints and extensions on the International FHIR resource [RequestGroup](https://hl7.org/fhir/R4/requestgroup.html)." />
  <purpose value="This profile is used to group collection of related resources (wrapper) to be embodied as a single message. E.g, collection of MedicationRequest resources to represent a prescription." />
  <copyright value="Copyright &amp;#169; 2025+ NHS England Licensed under the Apache License, Version 2.0 (the \&amp;quot;License\&amp;quot;); 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 \&amp;quot;AS IS\&amp;quot; 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. HL7&amp;#174; FHIR&amp;#174; standard Copyright &amp;#169; 2011+ HL7 The HL7&amp;#174; FHIR&amp;#174; standard is used under the FHIR license. You may obtain a copy of the FHIR license at  https://www.hl7.org/fhir/license.html." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="RequestGroup" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/RequestGroup" />
  <derivation value="constraint" />
  <differential>
    <element id="RequestGroup.extension:NHSBSAprescriptionType">
      <path value="RequestGroup.extension" />
      <sliceName value="NHSBSAprescriptionType" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.nhs.uk/StructureDefinition/Extension-DM-PrescriptionType" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="RequestGroup.extension:prescriptionPendingCancellation">
      <path value="RequestGroup.extension" />
      <sliceName value="prescriptionPendingCancellation" />
      <short value="An extension use to record if a prescription or any of its line items is pending cancellation." />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.nhs.uk/StructureDefinition/Extension-PendingCancellation" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="RequestGroup.extension:prescriptionStatusHistory">
      <path value="RequestGroup.extension" />
      <sliceName value="prescriptionStatusHistory" />
      <short value="Dispensing Prescription Status" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.nhs.uk/StructureDefinition/Extension-DM-PrescriptionStatusHistory" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="RequestGroup.extension:repeatInformation">
      <path value="RequestGroup.extension" />
      <sliceName value="repeatInformation" />
      <short value="An extension use to record both the instance and the maximum number of repeat allowed for a prescription." />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.nhs.uk/StructureDefinition/Extension-EPS-RepeatInformation" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="RequestGroup.action.participant">
      <path value="RequestGroup.action.participant" />
      <constraint>
        <key value="nhse-requsetgrp-001" />
        <requirements value="Only one of RequestGroup.action.participant or RequestGroup.action.participant.extension:participantR5 can be populated at a time." />
        <severity value="error" />
        <human value="If extension-ParticipantType R5 Backport is used then RequestGroup.action.participant  SHALL be empty." />
        <expression value="RequestGroup.action.participant.empty() or RequestGroup.action.participant.extension('http://hl7.org/fhir/5.0/StructureDefinition/extension-RequestOrchestration.action.participant.typeReference').empty()" />
      </constraint>
    </element>
    <element id="RequestGroup.action.participant.extension:participantR5">
      <path value="RequestGroup.action.participant.extension" />
      <sliceName value="participantR5" />
      <short value="An extension use to record the type of a participant designated to perform an action." />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/5.0/StructureDefinition/extension-RequestOrchestration.action.participant.typeReference" />
      </type>
      <isModifier value="false" />
    </element>
  </differential>
</StructureDefinition>