<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns="http://www.netdimensions.com/2005/10/trainingHistory"
           targetNamespace="http://www.netdimensions.com/2005/10/trainingHistory"
           elementFormDefault="qualified">

  <xs:element name="trainingHistory">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="dateCreated" type="xs:dateTime"/>
        <xs:element name="trainingRecord" type="trainingRecord" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:complexType name="trainingRecord">
    <xs:sequence>
      <xs:element name="userId" type="xs:string"/>
      <xs:element name="learningModule" type="learningModule"/>
      <xs:element name="enrollmentDate" type="xs:dateTime" minOccurs="0"/>
      <xs:element name="startDate" type="xs:dateTime" minOccurs="0"/>
      <xs:element name="endDate" type="xs:dateTime" minOccurs="0"/>
      <xs:element name="overallStatus" type="overallStatus"/>
      <xs:element name="score" type="xs:decimal" minOccurs="0"/>
      <xs:element name="lastAttemptDate" type="xs:dateTime" minOccurs="0"/>
      <xs:element name="attemptCount" type="xs:nonNegativeInteger"/>
      <xs:element name="isSelfEnrolled" type="xs:boolean"/>
    </xs:sequence>
    <xs:attribute name="id" use="required" type="xs:ID"/>
  </xs:complexType>

  <xs:complexType name="learningModule">
    <xs:sequence>
      <xs:element name="id" type="xs:string"/>
      <xs:element name="title" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

  <xs:simpleType name="overallStatus">
    <xs:restriction base="xs:NCName">
      <xs:enumeration value="administrativeEntry"/>
      <xs:enumeration value="cancelled"/>
      <xs:enumeration value="completed"/>
      <xs:enumeration value="enrolled"/>
      <xs:enumeration value="finishedUsing"/>
      <xs:enumeration value="incomplete"/>
      <xs:enumeration value="pendingApproval"/>
      <xs:enumeration value="resource"/>
      <xs:enumeration value="shared"/>
      <xs:enumeration value="unknown"/>
      <xs:enumeration value="waitlisted"/>
      <xs:enumeration value="withdrawn"/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>
