<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="ProfilesCatalog">
        <xs:complexType>
            <xs:choice minOccurs="1" maxOccurs="unbounded">
                <xs:element minOccurs="0" maxOccurs="unbounded" ref="ProfileGroup"/>
                <xs:element ref="AgentProfiles"/>
                <xs:element minOccurs="0" maxOccurs="1" ref="SystemProfiles"/>
            </xs:choice>
            <xs:attribute name="SchemaVersion" type="xs:string"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="ProfileGroup">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" maxOccurs="unbounded" ref="Profile"/>
            </xs:sequence>
            <xs:attribute name="Type" use="required" type="xs:NCName"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="AgentProfiles">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="1" maxOccurs="unbounded" ref="AgentProfile"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="AgentProfile">
        <xs:complexType>
            <xs:choice>
                <xs:sequence>
                    <xs:element ref="DriverProfiles"/>
                    <xs:element ref="SystemProfiles"/>
                    <xs:element ref="VehicleModels"/>
                </xs:sequence>
				<xs:sequence>
                    <xs:element ref="SystemProfiles"/>
                    <xs:element ref="DriverProfiles"/>
                    <xs:element ref="VehicleModels"/>
                </xs:sequence>
                <xs:sequence>
                    <xs:element ref="System"/>
                    <xs:element name="VehicleModel" type="xs:string"/>
                </xs:sequence>
				<xs:sequence>
                    <xs:element name="VehicleModel" type="xs:string"/>
                    <xs:element ref="System"/>
                </xs:sequence>
            </xs:choice>
            <xs:attribute name="Name" type="xs:NCName"/>
            <xs:attribute name="Type" type="xs:NCName"/>
        </xs:complexType>
    </xs:element>
	<xs:element name="System">
        <xs:complexType>
			<xs:all>
				<xs:element ref="File"/>
				<xs:element ref="Id"/>
			</xs:all>
        </xs:complexType>
    </xs:element>
    <xs:element name="File" type="xs:NCName"/>
    <xs:element name="Id" type="xs:integer"/>
    <xs:element name="DriverProfiles">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="1" maxOccurs="unbounded" ref="DriverProfile"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="DriverProfile">
        <xs:complexType>
            <xs:attribute name="Name" use="required" type="xs:NCName"/>
            <xs:attribute name="Probability" use="required" type="xs:double"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="Profile">
        <xs:complexType>
			<xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element ref="Bool"/>
                <xs:element ref="Double"/>
                <xs:element ref="String"/>
                <xs:element ref="List"/>
                <xs:element ref="UniformDistribution"/>
                <xs:element name="NormalDistribution"/>
                <xs:element name="LogNormalDistribution"/>
                <xs:element name="ExponentialDistribution"/>
                <xs:element name="GammaDistribution"/>
                <xs:element ref="DoubleVector"/>
				<xs:element ref="IntVector"/>
				<xs:element ref="StringVector"/>
			</xs:choice>
            <xs:attribute name="Name" use="required" type="xs:NCName"/>
            <xs:attribute name="Probability" type="xs:double"/>
            <xs:attribute name="Type" type="xs:NCName"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="String">
        <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: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="Double">
        <xs:complexType>
            <xs:attribute name="Key" use="required" type="xs:NCName"/>
            <xs:attribute name="Value" use="required" type="xs:double"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="UniformDistribution">
        <xs:complexType>
            <xs:attribute name="Key" use="required" type="xs:NCName"/>
            <xs:attribute name="Max" use="required" type="xs:double"/>
            <xs:attribute name="Min" use="required" type="xs:double"/>
        </xs:complexType>
    </xs:element>
	<xs:element name="List">
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="unbounded" ref="ListItem"/>
            </xs:sequence>
            <xs:attribute name="Name" use="required" type="xs:NCName"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="ListItem">
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element ref="String"/>
                <xs:element ref="StringVector"/>
                <xs:element ref="IntVector"/>
                <xs:element ref="Double"/>
                <xs:element ref="Reference"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
	<xs:element name="Reference">
        <xs:complexType>
            <xs:attribute name="Name" use="required" type="xs:NCName"/>
            <xs:attribute name="Type" use="required" type="xs:NCName"/>
        </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:element name="IntVector">
        <xs:complexType>
            <xs:attribute name="Key" use="required" type="xs:NCName"/>
            <xs:attribute name="Value" use="required"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="VehicleModels">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" maxOccurs="unbounded" ref="VehicleModel"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="SystemProfiles">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" maxOccurs="unbounded" ref="SystemProfile"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="SystemProfile">
        <xs:complexType>
            <xs:all minOccurs="0">
                <xs:element ref="Components"/>
                <xs:element ref="Sensors"/>
            </xs:all>
            <xs:attribute name="Name" use="required"/>
            <xs:attribute name="Probability" type="xs:double"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="VehicleModel">
        <xs:complexType>
            <xs:attribute name="Name" use="required" type="xs:NCName"/>
            <xs:attribute name="Probability" use="required" type="xs:double"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="Components">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" maxOccurs="unbounded" ref="Component"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="Component">
        <xs:complexType>
            <xs:all>
                <xs:element ref="Profiles"/>
                <xs:element minOccurs="0" ref="SensorLinks"/>
            </xs:all>
            <xs:attribute name="Type" use="required" type="xs:NCName"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="Profiles">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" maxOccurs="unbounded" ref="Profile"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="SensorLinks">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" maxOccurs="unbounded" ref="SensorLink"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="SensorLink">
        <xs:complexType>
            <xs:attribute name="InputId" use="required" type="xs:NCName"/>
            <xs:attribute name="SensorId" use="required" type="xs:integer"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="Sensors">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" maxOccurs="unbounded" ref="Sensor"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="Sensor">
        <xs:complexType>
            <xs:choice minOccurs="0">
                <xs:element ref="Position"/>
                <xs:element ref="Profile"/>
            </xs:choice>
            <xs:attribute name="Id" use="required" type="xs:integer"/>
            <xs:attribute name="Position" use="required" type="xs:NCName"/>
        </xs:complexType>
    </xs:element>
	<xs:element name="DoubleVector">
        <xs:complexType>
            <xs:attribute name="Key" use="required" type="xs:NCName"/>
            <xs:attribute name="Value" use="required"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="Position">
        <xs:complexType>
            <xs:attribute name="Height" use="required" type="xs:double"/>
            <xs:attribute name="Lateral" use="required" type="xs:double"/>
            <xs:attribute name="Longitudinal" use="required" type="xs:double"/>
            <xs:attribute name="Name" use="required" type="xs:NCName"/>
            <xs:attribute name="Pitch" use="required" type="xs:double"/>
            <xs:attribute name="Roll" use="required" type="xs:double"/>
            <xs:attribute name="Yaw" use="required" type="xs:double"/>
        </xs:complexType>
    </xs:element>
</xs:schema>
