<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsd:schema [
    <!ENTITY FloatPattern "(\-)?(\d+|(\d*.\d+))">
    <!ENTITY FloatPattern01 "(0|(0?.(\d+))|(1|1.0*))">
    <!ENTITY IntPattern255 "(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])">
]>
<xsd:schema elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <xsd:simpleType name="positiveFloatType">
        <xsd:restriction base="xsd:float">
            <xsd:minExclusive value="0"></xsd:minExclusive>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="nonNegativeFloatType">
        <xsd:restriction base="xsd:float">
            <xsd:minInclusive value="0"></xsd:minInclusive>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="boolType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="true"/>
            <xsd:enumeration value="false"/>
            <xsd:enumeration value="True"/>
            <xsd:enumeration value="False"/>
            <xsd:enumeration value="yes"/>
            <xsd:enumeration value="no"/>
            <xsd:enumeration value="on"/>
            <xsd:enumeration value="off"/>
            <xsd:enumeration value="1"/>
            <xsd:enumeration value="0"/>
            <xsd:enumeration value="x"/>
            <xsd:enumeration value="-"/>
        </xsd:restriction>
    </xsd:simpleType> 

    <xsd:simpleType name="colorType">
        <xsd:union>
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:pattern value="&FloatPattern01;,&FloatPattern01;,&FloatPattern01;(,&FloatPattern01;)?"/>
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:pattern value="&IntPattern255;,&IntPattern255;,&IntPattern255;(,&IntPattern255;)?"/>
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="red"/>
                    <xsd:enumeration value="green"/>
                    <xsd:enumeration value="blue"/>
                    <xsd:enumeration value="yellow"/>
                    <xsd:enumeration value="cyan"/>
                    <xsd:enumeration value="magenta"/>
                    <xsd:enumeration value="black"/>
                    <xsd:enumeration value="white"/>
                    <xsd:enumeration value="grey"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:union>
    </xsd:simpleType>

    <xsd:simpleType name="shapeType">
        <xsd:restriction base="xsd:string">
            <xsd:pattern
                value="&FloatPattern;,&FloatPattern;(,&FloatPattern;)?(\s&FloatPattern;,&FloatPattern;(,&FloatPattern;)?)+">
            </xsd:pattern>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="locationType">
        <xsd:attribute name="netOffset">
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:pattern value="&FloatPattern;,&FloatPattern;"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
        <xsd:attribute name="convBoundary">
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:pattern value="&FloatPattern;,&FloatPattern;,&FloatPattern;,&FloatPattern;"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
        <xsd:attribute name="origBoundary">
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:pattern value="&FloatPattern;,&FloatPattern;,&FloatPattern;,&FloatPattern;"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
        <xsd:attribute name="projParameter" type="xsd:string" use="required"/>
    </xsd:complexType>

    <xsd:complexType name="boolOptionType">
        <xsd:attribute name="value" type="boolType" use="required"/>
        <xsd:attribute name="synonymes" type="xsd:string" use="optional"/>
        <xsd:attribute name="type" type="xsd:string" use="optional"/>
        <xsd:attribute name="help" type="xsd:string" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="intOptionType">
        <xsd:attribute name="value" type="xsd:int" use="required"/>
        <xsd:attribute name="synonymes" type="xsd:string" use="optional"/>
        <xsd:attribute name="type" type="xsd:string" use="optional"/>
        <xsd:attribute name="help" type="xsd:string" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="floatOptionType">
        <xsd:attribute name="value" type="xsd:float" use="required"/>
        <xsd:attribute name="synonymes" type="xsd:string" use="optional"/>
        <xsd:attribute name="type" type="xsd:string" use="optional"/>
        <xsd:attribute name="help" type="xsd:string" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="timeOptionType">
        <xsd:attribute name="value" type="xsd:float" use="required"/>
        <xsd:attribute name="synonymes" type="xsd:string" use="optional"/>
        <xsd:attribute name="type" type="xsd:string" use="optional"/>
        <xsd:attribute name="help" type="xsd:string" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="strOptionType">
        <xsd:attribute name="value" type="xsd:string" use="required"/>
        <xsd:attribute name="synonymes" type="xsd:string" use="optional"/>
        <xsd:attribute name="type" type="xsd:string" use="optional"/>
        <xsd:attribute name="help" type="xsd:string" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="fileOptionType">
        <xsd:attribute name="value" type="xsd:string" use="required"/>
        <xsd:attribute name="synonymes" type="xsd:string" use="optional"/>
        <xsd:attribute name="type" type="xsd:string" use="optional"/>
        <xsd:attribute name="help" type="xsd:string" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="intArrayOptionType">
        <xsd:attribute name="value" use="required">
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:pattern value="(\-)?(\d+)(,(\-)?(\d+))*"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
        <xsd:attribute name="synonymes" type="xsd:string" use="optional"/>
        <xsd:attribute name="type" type="xsd:string" use="optional"/>
        <xsd:attribute name="help" type="xsd:string" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="tlLogicType">
        <xsd:sequence>
            <xsd:element name="phase" type="phaseType" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:string" use="required"/>
        <xsd:attribute name="type" type="tlTypeType" use="required"/>
        <xsd:attribute name="programID" type="xsd:string" use="required"/>
        <xsd:attribute name="offset" type="xsd:float" use="optional"/>
    </xsd:complexType>

    <xsd:simpleType name="tlTypeType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="actuated"/>
            <xsd:enumeration value="agentbased"/>
            <xsd:enumeration value="static"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="phaseType">
        <xsd:attribute name="duration" type="nonNegativeFloatType" use="required"/>
        <xsd:attribute name="minDur" type="nonNegativeFloatType" use="optional"/>
        <xsd:attribute name="maxDur" type="nonNegativeFloatType" use="optional"/>
        <xsd:attribute name="state" use="required">
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:pattern value="[ryYgGoO]+"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
    </xsd:complexType>

</xsd:schema>
