<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="profile-Bundle" />
  <url value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-mha-profile-bundle" />
  <version value="2.0.0" />
  <name value="Bundle" />
  <title value="MHA Bundle Profile" />
  <status value="active" />
  <date value="2025-05-17T20:17:06.3613088+00:00" />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="MHA-PDS-Mapping" />
    <name value="MHA PDS Mapping" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Bundle" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Bundle" />
  <derivation value="constraint" />
  <differential>
    <element id="Bundle">
      <path value="Bundle" />
      <constraint>
        <key value="mha-pds-bundle-inv-1" />
        <severity value="error" />
        <human value="Must contain exactly one patient resource in the bundle" />
        <expression value="entry.resource.ofType(Patient).count() = 1" />
      </constraint>
      <constraint>
        <key value="mha-pds-bundle-inv-2" />
        <severity value="error" />
        <human value="Must contain exactly one organization resource in the bundle" />
        <expression value="entry.resource.ofType(Organization).count() = 1" />
      </constraint>
      <constraint>
        <key value="mha-pds-bundle-inv-3" />
        <severity value="error" />
        <human value="Must contain exactly one location resource in the bundle" />
        <expression value="entry.resource.ofType(Location).count() = 1" />
      </constraint>
    </element>
    <element id="Bundle.meta">
      <path value="Bundle.meta" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.meta.lastUpdated">
      <path value="Bundle.meta.lastUpdated" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.meta.profile">
      <path value="Bundle.meta.profile" />
      <min value="1" />
      <max value="1" />
      <fixedCanonical value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-mha-profile-bundle" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.identifier">
      <path value="Bundle.identifier" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.type">
      <path value="Bundle.type" />
      <fixedCode value="collection" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.timestamp">
      <path value="Bundle.timestamp" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.entry">
      <path value="Bundle.entry" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.entry.fullUrl">
      <path value="Bundle.entry.fullUrl" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.entry.resource">
      <path value="Bundle.entry.resource" />
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>