<?xml version="1.0" encoding="UTF-8"?>

<OperationDefinition xmlns="http://hl7.org/fhir">
  <id value="ahd-complete"/>
  <text>
    <status value="generated"/><div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: OperationDefinition ahd-complete</b></p><a name="ahd-complete"> </a><a name="hcahd-complete"> </a><p>URL: [base]/QuestionnaireResponse/$complete</p><p>URL: [base]/QuestionnaireResponse/[id]/$complete</p><h3>Parameters</h3><table class="grid"><tr><td><b>Use</b></td><td><b>Name</b></td><td><b>Scope</b></td><td><b>Cardinality</b></td><td><b>Type</b></td><td><b>Binding</b></td><td><b>Documentation</b></td></tr><tr><td>IN</td><td>signedBinary</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R5/binary.html">Binary</a></td><td/><td><div><p>Digitally signed PET (ASiC-E container) as a Binary resource.</p>
</div></td></tr><tr><td>IN</td><td>bundle</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R5/bundle.html">Bundle</a></td><td/><td><div><p>Collection Bundle with the QuestionnaireResponse and the paper-signing Provenance.</p>
</div></td></tr><tr><td>OUT</td><td>questionnaireResponse</td><td/><td>1..1</td><td><a href="http://hl7.org/fhir/R5/references.html#Reference">Reference</a></td><td/><td><div><p>Reference to the stored PET version.</p>
</div></td></tr><tr><td>OUT</td><td>provenance</td><td/><td>1..1</td><td><a href="http://hl7.org/fhir/R5/references.html#Reference">Reference</a></td><td/><td><div><p>Reference to the stored signing Provenance.</p>
</div></td></tr><tr><td>OUT</td><td>signedBinary</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R5/references.html#Reference">Reference</a></td><td/><td><div><p>Reference to the stored signed Binary (digital signing only).</p>
</div></td></tr></table></div>
  </text>
  <url value="https://fhir.ee/ahd/OperationDefinition/ahd-complete"/>
  <version value="0.1.0"/>
  <name value="AHDQuestionnaireResponseComplete"/>
  <title value="PET confirmation ($complete)"/>
  <status value="active"/>
  <kind value="operation"/>
  <experimental value="false"/>
  <date value="2026-09-04T09:27:54+00:00"/>
  <publisher value="TEHIK"/>
  <contact>
    <name value="TEHIK"/>
    <telecom>
      <system value="url"/>
      <value value="https://tehik.ee"/>
    </telecom>
    <telecom>
      <system value="email"/>
      <value value="abi@tehik.ee"/>
    </telecom>
  </contact>
  <description value="UC-AHD-055: confirms a patient's end-of-life directive (PET). Input is exactly one of: a digitally signed PET as a Binary (signedBinary) or a QuestionnaireResponse and Provenance collection Bundle for paper signing (bundle). Under the stage-1 mock configuration, the digital path parses the ASiC-E container without DigiDoc signature verification and stores it locally instead of DRIT. Where digital signing is not enabled, the digital path responds with HTTP 501."/>
  <affectsState value="true"/>
  <code value="complete"/>
  <resource value="QuestionnaireResponse"/>
  <system value="false"/>
  <type value="true"/>
  <instance value="true"/>
  <parameter>
    <name value="signedBinary"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Digitally signed PET (ASiC-E container) as a Binary resource."/>
    <type value="Binary"/>
  </parameter>
  <parameter>
    <name value="bundle"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Collection Bundle with the QuestionnaireResponse and the paper-signing Provenance."/>
    <type value="Bundle"/>
  </parameter>
  <parameter>
    <name value="questionnaireResponse"/>
    <use value="out"/>
    <min value="1"/>
    <max value="1"/>
    <documentation value="Reference to the stored PET version."/>
    <type value="Reference"/>
  </parameter>
  <parameter>
    <name value="provenance"/>
    <use value="out"/>
    <min value="1"/>
    <max value="1"/>
    <documentation value="Reference to the stored signing Provenance."/>
    <type value="Reference"/>
  </parameter>
  <parameter>
    <name value="signedBinary"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Reference to the stored signed Binary (digital signing only)."/>
    <type value="Reference"/>
  </parameter>
</OperationDefinition>