﻿<?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 file structure.  BL is not a developer.-->
  <!--This schema is to convey the data structure of Flip files.  It is subject to interpretation-->
  <!--of the developer.  Some elements may be better rendered as attributes.  The developer is to 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="deck">
    <xs:complexType mixed="true">
      <xs:sequence>
        <!--properties and the elements under properties qualify as possible candidates for attributes-->
        <xs:element name="properties" minOccurs="1" maxOccurs="1">
          <xs:complexType mixed="true">
            <xs:sequence>
              <xs:element name="deckname" type="string" />
              <xs:element name="deckid" type="id" />
              <xs:element name="hyperlinkbase" type="string" />
              <xs:element name="comments" type="string" />
              <xs:element name="keywords" type="string" />
              <xs:element name="author" type="string" />
              <xs:element name="isbn" type="string" />
              <xs:element name="category" type="string" />
              <xs:element name="company" type="string" />
              <xs:element name="subject" type="string" />
              <xs:element name="manager" type="string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="section" minOccurs="1" maxOccurs="unbounded">
          <xs:complexType mixed="true">
            <xs:sequence>
              <xs:element name="sectionid" minOccurs="1" maxOccurs="1" type="id" />
              <xs:element name="sectionname" minOccurs="1" maxOccurs="1" type="string" />
              <!--section file can contain picture, video or audio content.  I assume that means binary data type -->
              <xs:element name="sectionfile" minOccurs="0" maxOccurs="1" type="binary" />
              <!--maxOccurs for side definition arbitrarily set at 20.  Technical limitations should be only consideration when determining this number. -->
              <xs:element name="sidedefinition" minOccurs="1" maxOccurs="20">
                <xs:complexType mixed="true">
                  <xs:sequence>
                    <xs:element name="sideid" minOccurs="1" maxOccurs="1" type="id" />
                    <xs:element name="sidename" minOccurs="1" maxOccurs="1" type="string" />
                    <!--keyboard will be some system value that designates a keyboard to be associated with the side -->
                    <!--value should be something universal to the OS and not specific to the PC.  Not sure if type is binary or string. -->
                    <xs:element name="keyboard" minOccurs="0" maxOccurs="1" type="binary" />
                    <xs:element name="cueexclusion" minOccurs="1" maxOccurs="1" type="boolean" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="card" minOccurs="1" maxOccurs="unbounded">
                <xs:complexType mixed="true">
                  <xs:sequence>
                    <!--cardid could be an attribute of card-->
                    <xs:element name="cardid" minOccurs="1" maxOccurs="1" type="id" />
                    <xs:element name="side" minOccurs="1" maxOccurs="20">
                      <xs:complexType mixed="true">
                        <xs:sequence>
                          <!--This sideid should correlate to an id from the sidedefinitions to designate the name, keyboard, and cue exclusion of the side -->
                          <!--sideid could be an attribute of side-->
                          <xs:element name="sideid" minOccurs="1" maxOccurs="1" type="id" />
                          <!--Content can contain a variety of differently formatted information.  -->
                          <!--I use side formatting tags to designate the type of content that will populate a content tag.-->
                          <!--I am a non-developer.  No promise is made that this is the correct way to approach this -->
                          <xs:element name="content" minOccurs="1" maxOccurs="1">
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="testcollection" minOccurs="1" maxOccurs="1">
          <xs:complexType mixed="true">
            <xs:sequence>
              <xs:element name="test" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType mixed="true">
                  <xs:sequence>
                    <xs:element name="testid" minOccurs="1" maxOccurs="1" type="id" />
                    <xs:element name="testname" minOccurs="1" maxOccurs="1" type="string" />
                    <xs:element name="authorpassword" minOccurs="0" maxOccurs="1" type="string" />
                    <!--cycle can be one time only, smart, or standard.  Type is string, but could just as easily be a small integer-->
                    <xs:element name="cycle" minOccurs="1" maxOccurs="1" type="string" />
                    <xs:element name="timed" minOccurs="1" maxOccurs="1" type="boolean" />
                    <xs:element name="allottime" minOccurs="1" maxOccurs="1" type="boolean" />
                    <xs:element name="allotval" minOccurs="0" maxOccurs="1" type="integer" />
                    <!--startview can be standard, 1side, or 2side. Type is string, but could just as easily be small integer-->
                    <xs:element name="startview" minOccurs="1" maxOccurs="1" type="string" />
                    <xs:element name="mcrand" minOccurs="1" maxOccurs="1" type="boolean" />
                    <xs:element name="explanation" minOccurs="1" maxOccurs="1" type="boolean" />
                    <!--explval can be allcardimmed, allcardend, userreq, onerrimmed or onerrend.  Type is string, but could be small int.-->
                    <xs:element name="explval" minOccurs="1" maxOccurs="1" type="string" />
                    <xs:element name="flash" minOccurs="1" maxOccurs="1" type="boolean" />
                    <xs:element name="flashquery" minOccurs="1" maxOccurs="1" type="boolean" />
                    <xs:element name="aniquery" minOccurs="0" maxOccurs="1" type="binary" />
                    <xs:element name="review" minOccurs="1" maxOccurs="1" type="boolean" />
                    <xs:element name="intropanel" minOccurs="0" maxOccurs="1">
                      <xs:complexType mixed="true">
                        <xs:sequence>
                          <xs:element name="tutor" minOccurs="1" maxOccurs="1" type="boolean" />
                          <xs:element name="content" minOccurs="0" maxOccurs="1" type="string" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="selectset" minOccurs="1" maxOccurs="1" type="boolean" />
                    <xs:element name="selectqty" minOccurs="0" maxOccurs="1" type="integer" />
                    <xs:element name="stack" minOccurs="1" maxOccurs="1">
                      <xs:complexType mixed="true">
                        <xs:sequence>
                          <xs:element name="section" minOccurs="1" maxOccurs="unbounded">
                            <xs:complexType mixed="true">
                              <xs:sequence>
                                <xs:element name="sectionnumber" minOccurs="1" maxOccurs="1" type="id" />
                                <xs:element name="order" minOccurs="1" maxOccurs="1" type="boolean" />
                                <!--cue can be random or a designated side.  Type is string but could be integer.  Type should accomodate max number of sides-->
                                <xs:element name="cue" minOccurs="1" maxOccurs="1" type="string" />
                                <xs:element name="corral" minOccurs="1" maxOccurs="1" type="boolean" />
                                <!--sideexcl is designation of any side(s).  Type is string, but could be array of integers.  maxOccurs=max number of sides - 1-->
                                <xs:element name="sideexcl" minOccurs="0" maxOccurs="19" type="string" />
                                <!--Selection is a list of the cards to be used in test.  Type is array, but should hold list of card ID's-->
                                <xs:element name="selection" minOccurs="1" maxOccurs="1" type="array" />
                              </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>