<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:element name="TestLog">
    <xs:complexType>
      <xs:sequence>
        <!-- Test keyword if we know it, otherwise, transaction keyword or whatever giving indications regarding the test performed -->
        <xs:element ref="Test" minOccurs="1" maxOccurs="1"/>
        <!-- Information about the ETS -->
        <xs:element ref="Tool" minOccurs="1" maxOccurs="1"/>
        <!-- when the test has been performed -->
        <xs:element ref="Date" minOccurs="1" maxOccurs="1"/>
        <!-- requester -->
        <xs:element ref="Source" minOccurs="1" maxOccurs="1"/>
        <!-- responder -->
        <xs:element ref="Target" minOccurs="1" maxOccurs="1"/>
        <!-- Messages sent and received -->
        <xs:element maxOccurs="unbounded" ref="Message" minOccurs="1"/>
        <!-- MSA-1 in HL7v2.x, can be HTTP response code for SOAP ... -->
        <xs:element ref="AcknowledgmentCode" minOccurs="0" maxOccurs="1"/>
        <!-- Something in the database of the ETS which uniquely identifies the test (message id for instance) -->
        <xs:element ref="LogEvent" minOccurs="1" maxOccurs="1"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Test" type="xs:string"/>
  <xs:element name="Tool">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Name" minOccurs="1" maxOccurs="1"/>
        <xs:element ref="URL" minOccurs="1" maxOccurs="1"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Name" type="xs:string"/>
  <xs:element name="Date" type="xs:string"/>
  <xs:element name="Source" type="xs:string"/>
  <xs:element name="Target" type="xs:string"/>
  <xs:element name="URL" type="xs:anyURI"/>
  <xs:element name="Message">
    <xs:complexType>
      <xs:sequence>
        <!-- if request and response are not stored together in the database of the ETS, the id of the current message -->
        <xs:element ref="Id" minOccurs="0" maxOccurs="1"/>
        <!-- actor keyword of the sender -->
        <xs:element ref="Actor" minOccurs="1" maxOccurs="1"/>
        <!-- Type of the sent message (MSH-9, action ...) -->
        <xs:element ref="MessageType" minOccurs="0" maxOccurs="1"/>
        <!-- result of the conformance test -->
        <xs:element ref="ValidationResult" minOccurs="0" maxOccurs="1"/>
      </xs:sequence>
      <xs:attribute name="type" use="required">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="request"/>
            <xs:enumeration value="response"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
  <xs:element name="Id" type="xs:string"/>
  <xs:element name="Actor" type="xs:string"/>
  <xs:element name="MessageType" type="xs:string"/>
  <xs:element name="ValidationResult">
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:enumeration value="PASSED"/>
        <xs:enumeration value="FAILED"/>
        <xs:enumeration value="UNKNOWN"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  <xs:element name="AcknowledgmentCode" type="xs:string"/>
  <xs:element name="LogEvent">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Id"/>
        <xs:element ref="URL"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
