<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="../schema2xhtml.xsl" type="text/xsl"?>

<!-- $Id: turnouts.xsd 17977 2011-07-18 17:23:46Z zoo $ -->

<!-- This schema is part of JMRI. Copyright 2009, 2010                      -->
<!--                                                                        -->
<!-- JMRI is free software; you can redistribute it and/or modify it under  -->
<!-- the terms of version 2 of the GNU General Public License as published  -->
<!-- by the Free Software Foundation. See the "COPYING" file for a copy     -->
<!-- of this license.                                                       -->
<!--                                                                        -->
<!-- JMRI is distributed in the hope that it will be useful, but WITHOUT    -->
<!-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or  -->
<!-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License  -->
<!-- for more details.                                                      -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:docbook="http://docbook.org/ns/docbook"
           xmlns:jmri="http://jmri.org/xml/schema/JMRIschema"
           xsi:schemaLocation="
                http://jmri.org/xml/schema/JMRIschema http://jmri.org/xml/schema/JMRIschema.xsd
                http://docbook.org/ns/docbook http://jmri.org/xml/schema/docbook/DocBook.xsd
            "
        >

  <xs:complexType name="TurnoutManagerType">
      <xs:annotation>
        <xs:documentation>
          Define the XML stucture for storing the contents of a TurnoutManager implementation.
        </xs:documentation>
        <xs:appinfo>
            <jmri:usingclass configurexml="true">jmri.managers.configurexml.AbstractTurnoutManagerConfigXML</jmri:usingclass>
        </xs:appinfo>
      </xs:annotation>

      <xs:sequence>

        <xs:element name="operations" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="operation" type="OperationType" minOccurs="0" maxOccurs="unbounded" />
            </xs:sequence>
            <xs:attribute name="automate" type="xs:string" use="required" />
          </xs:complexType>
        </xs:element>
    
        <xs:element name="turnout" type="TurnoutType" minOccurs="0" maxOccurs="unbounded" />
            
      </xs:sequence>
      <xs:attribute name="class" type="classType" use="required" />
  </xs:complexType>

  <xs:complexType name="TurnoutType">
    <xs:sequence>
      <xs:element name="operation" type="OperationType" minOccurs="0" maxOccurs="1" />
      <xs:element name="comment" type="commentType" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
    <xs:attribute name="systemName" type="systemNameType" use="required" />
    <xs:attribute name="userName" type="userNameType" />
    <xs:attribute name="feedback" type="xs:string" />
    <xs:attribute name="sensor1" type="xs:string" />
    <xs:attribute name="sensor2" type="xs:string" />
    <xs:attribute name="numBits" type="xs:int" />
    <xs:attribute name="controlType" type="xs:string" />
    <xs:attribute name="automate" type="xs:string" />

    <xs:attribute name="inverted" type="xs:boolean" default="false" />
    <xs:attribute name="locked" type="xs:boolean" default="false" />
    <xs:attribute name="lockMode" type="xs:string" />
    <xs:attribute name="decoder" type="xs:string" />

    <xs:attribute name="state" >
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="CLOSED"/>
          <xs:enumeration value="THROWN"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>

  </xs:complexType>

  <xs:complexType name="OperationType">
      <xs:attribute name="name" type="xs:string" use="required" />
      <xs:attribute name="class" type="classType" use="required" />
      <xs:attribute name="interval" type="xs:int" />
      <xs:attribute name="maxtries" type="xs:int" />
      <xs:attribute name="parameter1" type="xs:string" />
      <xs:attribute name="parameter2" type="xs:string" />
      <xs:attribute name="parameter3" type="xs:string" />
      <xs:attribute name="parameter4" type="xs:string" />
      <xs:attribute name="parameter5" type="xs:string" />
      <xs:attribute name="parameter6" type="xs:string" />
      <xs:attribute name="parameter7" type="xs:string" />
      <xs:attribute name="parameter8" type="xs:string" />
      <xs:attribute name="parameter9" type="xs:string" />
      <xs:attribute name="parameter10" type="xs:string" />
  </xs:complexType>

</xs:schema>

