<!--
		SIF Infrastructure Specification 3.7

		(January 21, 2025)
		
		Infrastructure Version: 3.7
		
		license: 
		    name: Apache  2.0
        identifier: Apache-2.0
        url: 'https://home.a4l.org/legal/'
	-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sifassociation.org/infrastructure/3.7" targetNamespace="http://www.sifassociation.org/infrastructure/3.7" elementFormDefault="qualified" version="3.7">
  <xs:complexType name="subscriptionType">
    <xs:annotation>
      <xs:appinfo>
        <sifChar />
        <privacyRating />
      </xs:appinfo>
      <xs:documentation>A Consumer uses the Subscriptions Infrastructure Service to subscribe to Events published by one or more Service Providers.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="zoneId" type="xs:token">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating />
          </xs:appinfo>
          <xs:documentation />
        </xs:annotation>
      </xs:element>
      <xs:element name="contextId" minOccurs="0" type="xs:token">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating />
          </xs:appinfo>
          <xs:documentation>The unique identity of a context element, which is associated with a Provider of this name and type operating in a Zone with this ID.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="serviceType" type="serviceTypeType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating />
          </xs:appinfo>
          <xs:documentation>The type of the service</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="serviceSubType" minOccurs="0" nillable="true" type="serviceSubTypeType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating />
          </xs:appinfo>
          <xs:documentation>The subtype of the Service</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="messageType" minOccurs="0" nillable="true" type="messageTypeType">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>O</sifChar>
            <privacyRating />
          </xs:appinfo>
          <xs:documentation>The type of the message</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="serviceName" type="xs:token">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating />
          </xs:appinfo>
          <xs:documentation>The name of the Service. For utilities, this is fixed to one of the defined set of Utility Service Names. For objects and functions, it is defined by the Data Model.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="queueId" type="xs:token">
        <xs:annotation>
          <xs:appinfo>
            <sifChar>M</sifChar>
            <privacyRating />
          </xs:appinfo>
          <xs:documentation>Specifies which queues you want data associated with this subscription published to.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="id" use="optional" type="uuidType">
      <xs:annotation>
        <xs:appinfo>
          <sifChar>O</sifChar>
          <privacyRating />
        </xs:appinfo>
        <xs:documentation />
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:element name="subscription" type="subscriptionType">
    <xs:key name="subscriptionKey1">
      <xs:selector xpath="." />
      <xs:field xpath="@id" />
    </xs:key>
  </xs:element>

  <xs:complexType name="subscriptionCollectionType">
    <xs:sequence>
      <xs:element name="subscription" type="subscriptionType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="subscriptions" type="subscriptionCollectionType" />

</xs:schema>