<!--
XML Schema for the Media API data types

This is NCL
Copyright: 005 PUC-RIO/LABORATORIO TELEMIDIA, All Rights Reserved.
See http://www.telemidia.puc-rio.br

Public URI: http://www.ncl.org.br/NCL3.1/ancillary/mediaAPI.xsd
Author: TeleMidia Laboratory
Revision: 30/06/2013

Schema for the NCL media API data types.
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
  xmlns:mediaAPI="http://www.ncl.org.br/NCL3.1/MediaAPI"
  targetNamespace="http://www.ncl.org.br/NCL3.1/MediaAPI"
  elementFormDefault="qualified" attributeFormDefault="unqualified" >

  <!-- define the temporalAnchorAttrs attribute group -->
  <attributeGroup name="temporalAnchorAttrs">
    <attribute name="begin" type="string" use="optional"/>
    <attribute name="end" type="string" use="optional"/>
  </attributeGroup>

  <!-- define the textAnchorAttrs attribute group -->
  <attributeGroup name="textAnchorAttrs">
    <attribute name="beginText" type="string" use="optional"/>
    <attribute name="beginPosition" type="unsignedLong" use="optional"/>
    <attribute name="endText" type="string" use="optional"/>
    <attribute name="endPosition" type="unsignedLong" use="optional"/>
  </attributeGroup>

  <!-- define the sampleAnchorAttrs attribute group -->
  <attributeGroup name="sampleAnchorAttrs">
    <attribute name="first" type="string" use="optional"/>
    <attribute name="last" type="string" use="optional"/>
  </attributeGroup>

  <!-- define the coordsAnchorAttrs attribute group -->
  <attributeGroup name="coordsAnchorAttrs">
    <attribute name="coords" type="string" use="optional"/>
  </attributeGroup>

  <!-- define the labelAttrs attribute group -->
  <attributeGroup name="labelAttrs">
    <attribute name="label" type="string" use="optional"/>
  </attributeGroup>

  <!-- define the clip attribute group -->
  <attributeGroup name="clipAttrs">
    <attribute name="clip" type="string" use="optional"/>
  </attributeGroup>

  <!-- define the default attribute group -->

  <!-- define the values for defaults-->
  <simpleType name="defaultType">
    <restriction base="string">
      <enumeration value="wholeContentAnchor" />
      <enumeration value="mainContentAnchor" />
    </restriction>
  </simpleType>

  <attributeGroup name="defaultAttrs">
    <attribute name="specialAnchor" type="mediaAPI:defaultType" use="optional"/>
  </attributeGroup>

  <!-- define the values for actions-->
  <simpleType name="actionType">
    <restriction base="string">
      <enumeration value="start" />
      <enumeration value="stop" />
      <enumeration value="pause" />
      <enumeration value="resume" />
      <enumeration value="abort" />
    </restriction>
  </simpleType>

  <!-- define the values for transistions-->
  <simpleType name="transitionType">
    <restriction base="string">
      <enumeration value="starts" />
      <enumeration value="stops" />
      <enumeration value="pauses" />
      <enumeration value="resumes" />
      <enumeration value="aborts" />
    </restriction>
  </simpleType>

  <!-- define the value for the content locator-->
  <simpleType name="URIlistPrototype">
    <list itemType="anyURI"/>
  </simpleType>

  <!-- define the values for transistions event type-->
  <simpleType name="eventRestrictedPrototype">
    <restriction base="string">
      <enumeration value="presentation" />
      <enumeration value="selection" />
    </restriction>
  </simpleType>

  <!-- define the values for properties-->
  <simpleType name="propertyPrototype">
    <restriction base="string">
      <enumeration value="layout" />
      <enumeration value="position" />
      <enumeration value="size" />
      <enumeration value="sizePosition" />
      <enumeration value="plane" />
      <enumeration value="device" />
      <enumeration value="time" />
      <enumeration value="color" />
      <enumeration value="percent" />
      <enumeration value="RGB888" />
      <enumeration value="fit" />
      <enumeration value="scroll" />
      <enumeration value="style" />
      <enumeration value="balance" />
      <enumeration value="alignment" />
      <enumeration value="fontStyle" />
      <enumeration value="fontFamily" />
      <enumeration value="fontSize" />
      <enumeration value="fontVariant" />
      <enumeration value="fontWeight" />
      <enumeration value="playerLife" />
      <enumeration value="optinal integer" />
      <enumeration value="optionalURI" />
      <enumeration value="optionalTransition" />
      <enumeration value="unsignedInteger" />
      <enumeration value="date" />
      <enumeration value="short" />
      <enumeration value="anyURI" />
      <enumeration value="ID" />
      <enumeration value="IDREF" />
      <enumeration value="unsigned short" />
      <enumeration value="long" />
      <enumeration value="unsigned long" />
      <enumeration value="float" />
      <enumeration value="double" />
      <enumeration value="char" />
      <enumeration value="string" />
      <enumeration value="Boolean" />
      <enumeration value="octet" />
    </restriction>
  </simpleType>

  <!-- declare global elements in this module -->
  <element name="transition" type="mediaAPI:transitionType"/>
  <element name="action" type="mediaAPI:actionType"/>


  <!-- define the <area> type-->
  <complexType name="anchorType">
    <attribute name="eventId" type="ID" use="required"/>
    <attribute name="eventType" type="mediaAPI:eventRestrictedPrototype" use="required"/>
    <attributeGroup ref="mediaAPI:coordsAnchorAttrs" />
    <attributeGroup ref="mediaAPI:temporalAnchorAttrs" />
    <attributeGroup ref="mediaAPI:textAnchorAttrs" />
    <attributeGroup ref="mediaAPI:sampleAnchorAttrs" />
    <attributeGroup ref="mediaAPI:labelAttrs" />
    <attributeGroup ref="mediaAPI:clipAttrs" />
    <attributeGroup ref="mediaAPI:defaultAttrs" />
  </complexType>

  <!-- declare global elements in this module -->
  <element name="area" type="mediaAPI:anchorType"/>

  <!-- define the <property> type-->
  <complexType name="propertyType">
    <attribute name="eventId" type="ID" use="required"/>
    <attribute name="name" type="string" use="required" />
    <attribute name="value" type="string" use="optional"/>
    <attribute name="type" type="mediaAPI:propertyPrototype" use="required"/>
    <attribute name="externable" type="boolean" use="required"/>
  </complexType>

  <!-- declare global elements in this module -->
  <element name="property" type="mediaAPI:propertyType"/>

  <!-- define the <media> and <event> types-->
  <group name="mediaInterfaceElementGroup">
    <choice>
      <element ref="mediaAPI:area"/>
      <element ref="mediaAPI:property"/>
    </choice>
  </group>

  <complexType name="mediaType">
        <choice minOccurs="0" maxOccurs="unbounded">
          <group ref="mediaAPI:mediaInterfaceElementGroup"/>
        </choice>
        <attribute name="src" type="mediaAPI:URIlistPrototype" use="required"/>
  </complexType>

  <complexType name="eventType">
    <choice minOccurs="1" maxOccurs="1">
      <group ref="mediaAPI:mediaInterfaceElementGroup"/>
    </choice>
  </complexType>

  <!-- declare global elements in this module -->
  <element name="media" type="mediaAPI:mediaType"/>
  <element name="event" type="mediaAPI:eventType"/>
</schema>