<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:heartbeat="urn:ericsson:com:ericsson:heartbeat:1.0"
   xmlns:ncEvent="urn:ietf:params:xml:ns:netconf:notification:1.0"
   xmlns:manageEvent="urn:ietf:params:xml:ns:netmod:notification"
   xmlns="urn:ericsson:com:netconf:notification:1.0"
   targetNamespace="urn:ericsson:com:netconf:notification:1.0"
   elementFormDefault="qualified"
   attributeFormDefault="unqualified"
   xml:lang="en" version="1.0">
   

   <xs:annotation>
      <xs:documentation xml:lang="en">
         This schema defines the structure of the notifications sent by
         notification service component of COM.
      </xs:documentation>
   </xs:annotation>

   <xs:import
      namespace="urn:ietf:params:xml:ns:netconf:notification:1.0"
      schemaLocation="ComCreateSubscription.xsd" />

 <xs:import namespace="urn:ericsson:com: ericsson:heartbeat:1.0"
      schemaLocation="ComHeartbeatNotification.xsd" />

 <!-- Three types of events for create-subscription filters... -->
   <xs:simpleType name="EventStringType">
      <xs:restriction base="xs:string">
         <xs:annotation>
            <xs:documentation xml:lang="en">
               Enumeration of the strings representing the possible
               types of events supported by the COM notification
               service.
            </xs:documentation>
         </xs:annotation>
         <xs:enumeration value="objectCreated" />
         <xs:enumeration value="objectDeleted" />
         <xs:enumeration value="attributeChanged" />
      </xs:restriction>
   </xs:simpleType>

  <!-- Type of the tag <event>, inside the tag <filter> of a
   create-subscription message -->
   <xs:complexType name="COMEventFilterType">
     <xs:complexContent>
         <xs:restriction base="xs:anyType">
            <xs:annotation>
               <xs:documentation xml:lang="en">
                  Structure of the element(s) to be included in the
                  filter element of the create-subscription message.
               </xs:documentation>
            </xs:annotation>
            <xs:sequence>
               <xs:element name="filterType" type="EventStringType"/>
               <xs:element name="filterValue" type="xs:string"/>
            </xs:sequence>
        </xs:restriction>
      </xs:complexContent>
   </xs:complexType>

   <!-- Declaration of the tag <event>, to be referenced in
   netconf.xsd schema, redefinition of netconf-RFC4741.xsd -->
  <xs:element name="event" type="COMEventFilterType" /> 

   <!-- Restriction of string simple type applied to dn strings -->
        <xs:simpleType name="dnType">
           <xs:annotation>
              <xs:documentation xml:lang="en">
                 Pattern to match a string representing the dn of the
                 MO which triggered a notification.
               </xs:documentation>
            </xs:annotation>
            <xs:restriction base="xs:string">
               <xs:pattern value="[a-zA-Z0-9]+=[a-zA-Z0-9]+(,*[a-zA-Z0-9]+=[a-zA-Z0-9]+)*"/>
            </xs:restriction>
        </xs:simpleType>

   <!-- Type of value tags -->
   <xs:complexType name="valueType" mixed="true">
      <xs:annotation>
         <xs:documentation xml:lang="en">
            Type of the tag &lt;v&gt;, containing a value for an
            attribute of a MO. Content can be a string (case of a
            single value), or a sequence of &lt;elem&gt; nodes (case
            of value is a struct).
         </xs:documentation>
      </xs:annotation>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
         <xs:element name="elem" type="vSequenceType">
            <xs:annotation>
               <xs:documentation xml:lang="en">
                  Tag &lt;elem&gt;, containing a list of values of a
                  struct entry. Requires a 'name' attribute.
               </xs:documentation>
            </xs:annotation>
         </xs:element>
      </xs:sequence>
   </xs:complexType>

   <!-- Base type of tags which require a name attribute (attr and
   elem) -->
   <xs:complexType name="tagWithNameAttrType">
      <xs:complexContent>
         <xs:restriction base="xs:anyType">
            <xs:attribute name="name" type="xs:string" use="required" />
         </xs:restriction>
      </xs:complexContent>
   </xs:complexType>

   <!-- Type of attr and elem tags (content is a sequence of v tags) -->
   <xs:complexType name="vSequenceType">
      <xs:annotation>
         <xs:documentation xml:lang="en">
            Type of tags &lt;attr&gt; and &lt;elem&gt;. Content is a
            list of all the values of the MO attribute or struct entry.
            Tags require a 'name' attribute.
         </xs:documentation>
      </xs:annotation>
      <xs:complexContent>
         <xs:extension base="tagWithNameAttrType">
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
               <xs:element name="v" type="valueType"/>
            </xs:sequence>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>

   <!-- Base type of the three possible event tags AVC, objectCreated,
   objectDeleted -->
   <xs:complexType name="eventType">
      <xs:annotation>
         <xs:documentation xml:lang="en">
            Base type of the tags representing a MO event:
            &lt;AVC&gt;, &lt;objectCreated&gt;, &lt;objectDeleted&gt;.
            These tags require a 'dn' attribute.
         </xs:documentation>
      </xs:annotation>
      <xs:complexContent>
         <xs:restriction base="xs:anyType">            
            <xs:attribute name="dn" type="dnType" use="required" />
         </xs:restriction>
      </xs:complexContent>
   </xs:complexType>

   <!-- Extension of the event type for AVC and objectCreated,
   describing content -->
   <xs:complexType name="attrEventType">
      <xs:annotation>
         <xs:documentation xml:lang="en">
            Type for event tags which must display the content of the
            attributes of a MO (&lt;AVC&gt; and &lt;objectCreated&gt;).
            Content is a list of &lt;attr&gt; elements.
         </xs:documentation>
      </xs:annotation>
      <xs:complexContent>
         <xs:extension base="eventType">
            <xs:sequence>
               <xs:element name="attr" type="vSequenceType"
               minOccurs="1" maxOccurs="unbounded">
                  <xs:annotation>
                     <xs:documentation xml:lang="en">
                        Tag &lt;attr&gt;, containing a list of all
                        values of a MO attribute. Requires a 'name'
                        attribute.
                     </xs:documentation>
                  </xs:annotation>
               </xs:element>
            </xs:sequence>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>

  <xs:complexType name="objectCreateAttrEventType">
      <xs:annotation>
         <xs:documentation xml:lang="en">
            Type for event tags which must display the content of the
            attributes of a MO (&lt;AVC&gt; and &lt;objectCreated&gt;).
            Content is a list of &lt;attr&gt; elements.
         </xs:documentation>
      </xs:annotation>
      <xs:complexContent>
         <xs:extension base="eventType">
            <xs:sequence>
               <xs:element name="attr" type="vSequenceType"
               minOccurs="0" maxOccurs="unbounded">
                  <xs:annotation>
                     <xs:documentation xml:lang="en">
                        Tag &lt;attr&gt;, containing a list of all
                        values of a MO attribute. Requires a 'name'
                        attribute.
                     </xs:documentation>
                  </xs:annotation>
               </xs:element>
            </xs:sequence>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>

   <!-- Type of the tag <events>, containing COM Notifiation content -->
   <xs:complexType name="eventsType">
      <xs:annotation>
         <xs:documentation xml:lang="en">
            Type for &lt;events&gt; tag, containing a sequence of
            event tags (&lt;AVC&gt;, &lt;objectCreated&gt; or
            &lt;objectDeleted&gt;).
         </xs:documentation>
      </xs:annotation>
      <xs:complexContent>
         <xs:extension base="ncEvent:NotificationContentType">
            <xs:sequence minOccurs="1" maxOccurs="unbounded">
               <xs:choice>
                  <xs:element name="AVC" type="attrEventType"/>
                  <xs:element name="objectCreated" type="objectCreateAttrEventType"/>
                  <xs:element name="objectDeleted" type="eventType"/>
               </xs:choice>
            </xs:sequence>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>

   <!-- Declaration of the element <events> -->
   <xs:element name="events" 
   substitutionGroup="ncEvent:notificationContent">
      <xs:annotation>
         <xs:documentation xml:lang="en">
            Tag to be sent in a &lt;notification&gt; message to inform
            about one or more MO events (attribute value changed -AVC-,
            object created or object deleted).
         </xs:documentation>
      </xs:annotation>
      <xs:complexType> 
        <xs:complexContent>
                <xs:extension base="eventsType">
                         <xs:attribute name="dnPrefix" type="dnType" use="required" />
                </xs:extension>
        </xs:complexContent>
     </xs:complexType>
  </xs:element>

   <!-- Declaration of the element <CMSynchronizationRecommended> -->
   <xs:element name="CMSynchronizationRecommended"
   substitutionGroup="ncEvent:notificationContent" >
      <xs:annotation>
         <xs:documentation xml:lang="en">
            Tag to be sent in a &lt;notification&gt; message to inform
            about an overflow in the queue of notification messages for
            this subscription.
         </xs:documentation>
      </xs:annotation>
       <xs:complexType> 
        <xs:complexContent>
                <xs:extension base="ncEvent:NotificationContentType">
                         <xs:attribute name="dnPrefix" type="dnType" use="required" />
                </xs:extension>
        </xs:complexContent>
     </xs:complexType>
   </xs:element>

   <!-- Declaration of the element <replayTimeUnsupported> -->
   <xs:element name="replayTimeUnsupported"
   substitutionGroup="ncEvent:notificationContent" >
      <xs:annotation>
         <xs:documentation xml:lang="en">
            Tag to be sent in a  &lt;notification&gt; message to inform
            that the start time specified in a 'create subscription'
            message (for a subscription with replay) is earlier than
            the earliest time stored in the replay buffer.
         </xs:documentation>
      </xs:annotation>
      <xs:complexType> 
        <xs:complexContent>
                <xs:extension base="ncEvent:NotificationContentType">
                         <xs:attribute name="dnPrefix" type="dnType" use="required" />
                </xs:extension>
        </xs:complexContent>
     </xs:complexType>
   </xs:element>


</xs:schema>