﻿<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <!--Written by Byron Law (BL).  Schema for Flip profile structure.  BL is not a developer.-->
  <!--This schema is to convey the data structure of Flip profiles.  It is subject to interpretation-->
  <!--of the developer.  Some elements may be better rendered as attributes.  The developer is to not-->
  <!--rely solely on this as the definition of the data structure and they should use their-->
  <!--best judgement as a developer to determine how an item best fits in the data structure and ask-->
  <!--questions if in doubt.  Comments have been made to help clarify.-->
  <!--December 27, 2007-->
  <xs:element name="profile">
    <xs:complexType mixed="true">
      <xs:sequence>
        <xs:element name="user" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType mixed="true">
            <xs:sequence>
              <xs:element name="userid" minOccurs="1" maxOccurs="1" type="id"/>
              <xs:element name="login" minOccurs="1" maxOccurs="1" type="string"/>
              <!--password should obviously be encrypted-->
              <xs:element name="password" minOccurs="1" maxOccurs="1" type="string"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="results" minOccurs="0" maxOccurs="1">
          <xs:complexType mixed="true">
            <xs:sequence>
              <xs:element name="session" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType mixed="true">
                  <xs:sequence>
                    <!--sessionid generated by application at start of session-->
                    <xs:element name="sessionid" minOccurs="1" maxOccurs="1" type="id"/>
                    <!--deckid and testid passed from the application and the deck file-->
                    <xs:element name="deckid" minOccurs="1" maxOccurs="1" type="id"/>
                    <xs:element name="testid" minOccurs="1" maxOccurs="1" type="id"/>
                    <!--exclude dictates if the session is excluded from report calculations-->
                    <xs:element name="exclude" minOccurs="1" maxOccurs="1" type="boolean"/>
                    <!--startdate of session passed by the application-->
                    <xs:element name="startdate" minOccurs="1" maxOccurs="1" type="datetime"/>
                    <!--quantity of cards responded to passed by the application-->
                    <xs:element name="qtyresponded" minOccurs="1" maxOccurs="1" type="integer"/>
                    <!--quantity of correct responses passed by application at end of session-->
                    <xs:element name="qtycorrect" minOccurs="1" maxOccurs="1" type="integer"/>
                    <!--enddate of session passed by the application-->
                    <xs:element name="enddate" minOccurs="1" maxOccurs="1" type="datetime"/>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="leitner" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType mixed="true">
            <xs:sequence>
              <xs:element name="deck" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType mixed="true">
                  <xs:sequence>
                    <xs:element name="deckid" minOccurs="0" maxOccurs="unbounded" type="id"/>
                    <!--deckname holds the name of the deck for reporting purposes-->
                    <xs:element name="deckname" minOccurs="0" maxOccurs="unbounded" type="string"/>
                    <xs:element name="leitnerscore" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType mixed="true">
                        <xs:sequence>
                          <xs:element name="sideid" minOccurs="1" maxOccurs="unbounded">
                            <xs:complexType mixed="false">
                              <xs:sequence>
                                <!--score should be an element (an attribute of sideid?) that is dynamically updated -->
                                <!--with a positive or negative number (within the range of possible -->
                                <!--Leitner scores) or a 'reset' which sets the score to 0-->
                                <xs:element name="score" minOccurs="1" maxOccurs="unbounded" type="integer"/>
                                <!--cardid holds the associated cardnumber for reporting purposes-->
                                <xs:element name="cardid" minOccurs="1" maxOccurs="unbounded" type="id"/>
                                <!--sidename holds the name of the side for reporting purposes-->
                                <xs:element name="sidename" minOccurs="1" maxOccurs="unbounded" type="string"/>
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>