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

<!-- This schema is part of JMRI. Copyright 2009, 2017                           -->

<!-- Need annotations                                                 -->
<!-- Attributes need to get types right esp. for enumerated           -->
<!-- Attributes need REQUIRED/IMPLIED                                 -->

<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
            "
        >
        
    <!-- not complete -->
    
    <xs:complexType name="SignalGroupManagerType">
      <xs:annotation>
        <xs:documentation>
          Define the XML structure for storing the contents of a SignalGroupManager implementation.
        </xs:documentation>
        <xs:appinfo>
            <jmri:usingclass configurexml="true">jmri.managers.configurexml.DefaultSignalGroupManagerXml</jmri:usingclass>
        </xs:appinfo>
      </xs:annotation>
      <xs:sequence>
        <xs:element name="signalgroup" type="SignalGroupType" minOccurs="0" maxOccurs="unbounded" />      
      </xs:sequence>
      <xs:attribute name="class" type="classType" use="required" />
    </xs:complexType>

    <xs:complexType name="SignalGroupType">
      <xs:annotation>
        <xs:documentation>
          Define the XML structure for storing the contents of one SignalGroup implementation.
          Generally dealt with by the manager implemenation
        </xs:documentation>
        <xs:appinfo>
            <jmri:usingclass configurexml="true">jmri.managers.configurexml.DefaultSignalGroupManagerXml</jmri:usingclass>
        </xs:appinfo>
      </xs:annotation>
      <xs:sequence>
        <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="appearance" minOccurs="0" maxOccurs="unbounded" >
          <xs:complexType>
            <xs:attribute name="valid" type="xs:string" use="required" >
              <xs:annotation>
                <xs:documentation>Deprecated 4.7.2 in favor of aspect (properly named) element</xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element name="aspect" minOccurs="0" maxOccurs="unbounded" >
          <xs:complexType>
            <xs:attribute name="valid" type="xs:string" use="required" >
              <xs:annotation>
                <xs:documentation>aspect for which heads are defined. set minOccurs to 1 in 4.8</xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>

        <xs:element name="signalHead" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="turnout" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="name" type="xs:string" use="required"/>
                      <xs:attribute name="state" type="xs:string" use="required">
                        <xs:annotation>
                          <xs:documentation>Specifies Turnout used as conditional with state for Closed/True</xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>

              <xs:element name="sensor" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="name" type="xs:string" use="required"/>
                      <xs:attribute name="state" type="xs:string" use="required">
                        <xs:annotation>
                          <xs:documentation>Specifies Sensor used as conditional with state for Active/True</xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="name" type="xs:string"/>
            <xs:attribute name="onAppearance" type="xs:string"/>
            <xs:attribute name="offAppearance" type="xs:string"/>
            <xs:attribute name="sensorTurnoutLogic" type="xs:string"/>
          </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="signalMast" type="xs:string"/>
    </xs:complexType>

</xs:schema>
