<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="pcm-endpoint" />
  <url value="http://pcm.fhir.health.gov.il/StructureDefinition/pcm-endpoint" />
  <version value="0.3.2" />
  <name value="PCMEndpoint" />
  <title value="PCM Endpoint" />
  <status value="active" />
  <description value="Authoritative FHIR REST API Endpoint of a Data Source organization. The owning Data Source controls technical availability through status and may update the address under the documented transition rules. Identity, ownership, and certificate inventory remain PCM-controlled." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Endpoint" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Endpoint" />
  <derivation value="constraint" />
  <differential>
    <element id="Endpoint.id">
      <path value="Endpoint.id" />
      <min value="1" />
    </element>
    <element id="Endpoint.meta">
      <path value="Endpoint.meta" />
      <min value="1" />
    </element>
    <element id="Endpoint.meta.lastUpdated">
      <path value="Endpoint.meta.lastUpdated" />
      <comment value="Server-managed timestamp of the most recent authoritative resource change." />
      <min value="1" />
    </element>
    <element id="Endpoint.meta.profile">
      <path value="Endpoint.meta.profile" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <comment value="PCM includes the applicable server-return profile URL; additional compatible profile URLs are allowed." />
      <min value="1" />
    </element>
    <element id="Endpoint.meta.profile:pcmProfile">
      <path value="Endpoint.meta.profile" />
      <sliceName value="pcmProfile" />
      <min value="1" />
      <max value="1" />
      <fixedCanonical value="http://pcm.fhir.health.gov.il/StructureDefinition/pcm-endpoint" />
    </element>
    <element id="Endpoint.extension">
      <path value="Endpoint.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <ordered value="false" />
        <rules value="open" />
      </slicing>
    </element>
    <element id="Endpoint.extension:applicableCertificates">
      <path value="Endpoint.extension" />
      <sliceName value="applicableCertificates" />
      <comment value="PCM-managed read-only projection of certificate thumbprints explicitly associated with this Endpoint. The inventory is not a complete trust-store view, proof of current certificate use, or an authorization decision." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://pcm.fhir.health.gov.il/StructureDefinition/ext-applicable-certificates" />
      </type>
    </element>
    <element id="Endpoint.status">
      <path value="Endpoint.status" />
      <comment value="Technical availability declared by the owning Data Source: active is usable, suspended is temporarily unavailable, and off is terminal. Only active Endpoints are eligible for Data Source token issuance and active introspection. Endpoint state does not change Consent lifecycle." />
      <binding>
        <strength value="required" />
        <valueSet value="http://pcm.fhir.health.gov.il/ValueSet/pcm-endpoint-status" />
      </binding>
    </element>
    <element id="Endpoint.connectionType">
      <path value="Endpoint.connectionType" />
      <comment value="PCM endpoints are FHIR REST endpoints." />
    </element>
    <element id="Endpoint.connectionType.system">
      <path value="Endpoint.connectionType.system" />
      <min value="1" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/endpoint-connection-type" />
    </element>
    <element id="Endpoint.connectionType.code">
      <path value="Endpoint.connectionType.code" />
      <min value="1" />
      <fixedCode value="hl7-fhir-rest" />
    </element>
    <element id="Endpoint.name">
      <path value="Endpoint.name" />
      <max value="0" />
    </element>
    <element id="Endpoint.managingOrganization">
      <path value="Endpoint.managingOrganization" />
      <comment value="The Data Source organization that owns this endpoint." />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://pcm.fhir.health.gov.il/StructureDefinition/pcm-organization-source" />
      </type>
    </element>
    <element id="Endpoint.managingOrganization.reference">
      <path value="Endpoint.managingOrganization.reference" />
      <min value="1" />
    </element>
    <element id="Endpoint.managingOrganization.identifier">
      <path value="Endpoint.managingOrganization.identifier" />
      <max value="0" />
    </element>
    <element id="Endpoint.contact">
      <path value="Endpoint.contact" />
      <max value="0" />
    </element>
    <element id="Endpoint.period">
      <path value="Endpoint.period" />
      <max value="0" />
    </element>
    <element id="Endpoint.payloadType">
      <path value="Endpoint.payloadType" />
      <comment value="General payload coding for a FHIR REST Endpoint. Supported resources and interactions are defined by the Data Source CapabilityStatement; this value does not widen authorization." />
      <max value="1" />
      <fixedCodeableConcept>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/endpoint-payload-type" />
          <code value="any" />
        </coding>
      </fixedCodeableConcept>
    </element>
    <element id="Endpoint.payloadType.coding">
      <path value="Endpoint.payloadType.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Endpoint.payloadMimeType">
      <path value="Endpoint.payloadMimeType" />
      <max value="0" />
    </element>
    <element id="Endpoint.address">
      <path value="Endpoint.address" />
      <comment value="Base URL of the organization's FHIR REST API and the exact OAuth resource/audience for Data Source access. A change invalidates authorization for the previous address." />
    </element>
    <element id="Endpoint.header">
      <path value="Endpoint.header" />
      <max value="0" />
    </element>
  </differential>
</StructureDefinition>