<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="simulationConfig">
        <xs:complexType>
            <xs:all>
                <xs:element ref="ProfilesCatalog"/>
                <xs:element ref="Experiment"/>
                <xs:element ref="Scenario"/>
                <xs:element ref="Environment"/>
                <xs:element ref="Observations"/>
                <xs:element ref="Spawners"/>
            </xs:all>
            <xs:attribute type="xs:string" name="SchemaVersion"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="ProfilesCatalog" type="xs:NCName"/>
    <xs:element name="Experiment">
        <xs:complexType>
            <xs:all>
                <xs:element ref="ExperimentID"/>
                <xs:element ref="NumberOfInvocations"/>
                <xs:element ref="RandomSeed"/>
                <xs:element ref="Libraries"/>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <xs:element name="ExperimentID" type="xs:integer"/>
    <xs:element name="NumberOfInvocations" type="xs:integer"/>
    <xs:element name="RandomSeed" type="xs:integer"/>
    <xs:element name="Libraries">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="WorldLibrary"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="WorldLibrary" type="xs:NCName"/>
    <xs:element name="Scenario">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="OpenScenarioFile"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="OpenScenarioFile" type="xs:NCName"/>
    <xs:element name="Environment">
        <xs:complexType>
            <xs:all>
                <xs:element minOccurs="1" ref="TimeOfDays"/>
                <xs:element minOccurs="1" ref="VisibilityDistances"/>
                <xs:element minOccurs="1" ref="Frictions"/>
                <xs:element minOccurs="1" ref="Weathers"/>
                <xs:element minOccurs="1" ref="TrafficRules"/>
                <xs:element minOccurs="0" ref="TurningRates"/>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <xs:element name="TimeOfDays">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="TimeOfDay" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="TimeOfDay">
        <xs:complexType>
            <xs:attribute type="xs:double" name="Probability" use="required"/>
            <xs:attribute type="xs:double" name="Value" use="required"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="VisibilityDistances">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="VisibilityDistance" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="VisibilityDistance">
        <xs:complexType>
            <xs:attribute type="xs:double" name="Probability" use="required"/>
            <xs:attribute type="xs:double" name="Value" use="required"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="Frictions">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Friction" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="Friction">
        <xs:complexType>
            <xs:attribute type="xs:double" name="Probability"/>
            <xs:attribute type="xs:double" name="Value"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="Weathers">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Weather" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="Weather">
        <xs:complexType>
            <xs:attribute type="xs:double" name="Probability" use="required"/>
            <xs:attribute type="xs:string" name="Value" use="required"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="TrafficRules" type="xs:NCName"/>
    <xs:element name="TurningRates">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="TurningRate" maxOccurs="unbounded" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="TurningRate">
        <xs:complexType>
            <xs:attribute type="xs:NCName" name="Incoming" use="required"/>
            <xs:attribute type="xs:NCName" name="Outgoing" use="required"/>
            <xs:attribute type="xs:double" name="Weight" use="required"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="Observations">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Observation" maxOccurs="unbounded" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="Observation">
        <xs:complexType>
            <xs:all>
                <xs:element ref="Library"/>
                <xs:element ref="Parameters"/>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <xs:element name="Library" type="xs:NCName"/>
    <xs:element name="Parameters">
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element ref="String"/>
                <xs:element ref="Bool"/>
                <xs:element ref="StringVector"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
    <xs:element name="Spawners">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Spawner" maxOccurs="unbounded" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="Spawner">
        <xs:complexType>
            <xs:all>
                <xs:element ref="Library"/>
                <xs:element ref="Type"/>
                <xs:element ref="Priority"/>
                <xs:element ref="Profile" minOccurs="0"/>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <xs:element name="Type" type="xs:NCName"/>
    <xs:element name="Priority" type="xs:integer"/>
    <xs:element name="Profile" type="xs:NCName"/>
    <xs:element name="String">
        <xs:complexType>
            <xs:attribute name="Key" use="required" type="xs:NCName"/>
            <xs:attribute name="Value" use="required" type="xs:NCName"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="Bool">
        <xs:complexType>
            <xs:attribute name="Key" use="required" type="xs:NCName"/>
            <xs:attribute name="Value" use="required" type="xs:boolean"/>
        </xs:complexType>
    </xs:element>
	<xs:element name="StringVector">
        <xs:complexType>
            <xs:attribute name="Key" use="required" type="xs:NCName"/>
            <xs:attribute name="Value" use="required" type="xs:string"/>
        </xs:complexType>
    </xs:element>
</xs:schema>
