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

<!-- $Id: signalmasts-2-9-6.xsd 21890 2012-12-18 09:33:09Z kevin-dickerson $ -->

<!-- This schema is part of JMRI. Copyright 2009.                           -->
<!--                                                                        -->
<!-- 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="SignalMastManagerType">
      <xs:annotation>
        <xs:documentation>
          Define the XML stucture for storing the contents of a SignalMastManager implementation.
        </xs:documentation>
        <xs:appinfo>
            <jmri:usingclass configurexml="true">jmri.managers.configurexml.DefaultSignalMastManagerXml</jmri:usingclass>
        </xs:appinfo>
      </xs:annotation>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element name="turnoutsignalmast" type="TurnoutSignalMastType" minOccurs="0" maxOccurs="unbounded" />
        <xs:element name="dccsignalmast" type="DccSignalMastType" minOccurs="0" maxOccurs="unbounded" />
        <xs:element name="signalmast" type="SignalMastType" minOccurs="0" maxOccurs="unbounded" />
        <xs:element name="virtualsignalmast" type="SignalMastType" minOccurs="0" maxOccurs="unbounded" />
        <xs:element name="signalmastrepeater" type="SignalMastRepeater" minOccurs="0" maxOccurs="unbounded" />
      </xs:sequence>
      <xs:attribute name="class" type="classType" use="required" />
    </xs:complexType>

    <xs:complexType name="SignalMastType">
      <xs:annotation>
        <xs:documentation>
          Define the XML stucture for storing the contents of one SignalMast implementation.
          Generally dealt with by the manager implemenation
        </xs:documentation>
        <xs:appinfo>
            <jmri:usingclass configurexml="true">jmri.implementation.configurexml.SignalHeadSignalMastXml</jmri:usingclass>
        </xs:appinfo>
      </xs:annotation>
      <xs:sequence minOccurs="1" maxOccurs="unbounded">

        <xs:element name="systemName" type="systemNameType" minOccurs="1" maxOccurs="1"/>
        <xs:element name="userName" type="userNameType" minOccurs="0" maxOccurs="1"/>
        <xs:element name="comment" type="commentType" minOccurs="0" maxOccurs="1" />
        <xs:element name="disabledAspects" minOccurs="0" maxOccurs="unbounded" >
          <xs:complexType>
            <xs:sequence>
              <xs:element name="disabledAspect" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>

      </xs:sequence>
      <xs:attribute name="systemName" type="systemNameType">
        <xs:annotation><xs:documentation>Deprecated 2.9.6 in favor of separate element</xs:documentation></xs:annotation>
      </xs:attribute>
      <xs:attribute name="userName" type="userNameType">
        <xs:annotation><xs:documentation>Deprecated 2.9.6 in favor of separate element</xs:documentation></xs:annotation>
      </xs:attribute>
      <xs:attribute name="class" type="classType" />
    </xs:complexType>
    
    <xs:complexType name="TurnoutSignalMastType">
      <xs:annotation>
        <xs:documentation>
          Define the XML stucture for storing the contents of one Turnout Based Signal Mast implementation.
        </xs:documentation>
        <xs:appinfo>
            <jmri:usingclass configurexml="true">jmri.implementation.configurexml.TurnoutSignalMastXml</jmri:usingclass>
        </xs:appinfo>
      </xs:annotation>
      <xs:sequence minOccurs="1" maxOccurs="unbounded">
        <xs:element name="systemName" type="systemNameType" minOccurs="1" maxOccurs="1"/>
        <xs:element name="userName" type="userNameType" minOccurs="0" maxOccurs="1"/>
        <xs:element name="comment" type="commentType" minOccurs="0" maxOccurs="1" />
        <xs:element name="aspect" minOccurs="0" maxOccurs="unbounded" >
          <xs:complexType>
            <xs:sequence>
              <xs:element name="turnout" type="xs:string"/>
              <xs:element name="turnoutstate" type="xs:string" />
            </xs:sequence>
            <xs:attribute name="defines"  use="required">
                <xs:annotation><xs:documentation>Specifies which appearance the turnout drives</xs:documentation></xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element name="disabledAspects" minOccurs="0" maxOccurs="1" >
          <xs:complexType>
            <xs:sequence>
              <xs:element name="disabledAspect" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="userName" type="userNameType">
        <xs:annotation><xs:documentation>Deprecated 2.9.6 in favor of separate element</xs:documentation></xs:annotation>
      </xs:attribute>
      <xs:attribute name="class" type="classType" use="required" />
    </xs:complexType>
    
    <xs:complexType name="DccSignalMastType">
      <xs:annotation>
        <xs:documentation>
          Define the XML stucture for storing the contents of one DCC Based Signal Mast implementation.
        </xs:documentation>
        <xs:appinfo>
            <jmri:usingclass configurexml="true">jmri.implementation.configurexml.DccSignalMastXml</jmri:usingclass>
        </xs:appinfo>
      </xs:annotation>
      <xs:sequence minOccurs="1" maxOccurs="unbounded">
        <xs:element name="systemName" type="systemNameType" minOccurs="1" maxOccurs="1"/>
        <xs:element name="userName" type="userNameType" minOccurs="0" maxOccurs="1"/>
        <xs:element name="comment" type="commentType" minOccurs="0" maxOccurs="1" />
        <xs:element name="aspect" minOccurs="0" maxOccurs="unbounded" >
          <xs:complexType>
            <xs:sequence>
              <xs:element name="number" type="xs:string"/>
            </xs:sequence>
            <xs:attribute name="defines"  use="required">
                <xs:annotation><xs:documentation>Specifies which appearance the turnout drives</xs:documentation></xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element name="disabledAspects" minOccurs="0" maxOccurs="1" >
          <xs:complexType>
            <xs:sequence>
              <xs:element name="disabledAspect" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="userName" type="userNameType">
        <xs:annotation><xs:documentation>Deprecated 2.9.6 in favor of separate element</xs:documentation></xs:annotation>
      </xs:attribute>
      <xs:attribute name="class" type="classType" use="required" />
    </xs:complexType>
    
    <xs:complexType name="SignalMastRepeater">
      <xs:annotation>
        <xs:documentation>
          Define the XML stucture for storing the contents of one Signal Mast Repeater implementation.
        </xs:documentation>
      </xs:annotation>
      <xs:sequence minOccurs="1" maxOccurs="unbounded">
        <xs:element name="masterMast" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="slaveMast" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="enabled" type="xs:string" minOccurs="0" maxOccurs="1" />
        <xs:element name="update" minOccurs="0" maxOccurs="1">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:enumeration value="BothWay"/>
              <xs:enumeration value="MasterToSlave"/>
              <xs:enumeration value="SlaveToMaster"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>

</xs:schema>
