<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- ***************************************************************************
 * Copyright (c) 2014 École Polytechnique de Montréal
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License 2.0 which
 * accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *   Florian Wininger - Initial API and implementation
 *************************************************************************** -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	attributeFormDefault="unqualified" elementFormDefault="qualified">

	<xs:complexType name="definedValue">
		<xs:annotation>
			<xs:documentation>Maps a string (usually a human-readable value used by the XML elements) to another string (a value in the system, which can be converted to an integer, long by the a stateValue element or used as-is).</xs:documentation></xs:annotation>
		<xs:attribute name="name" type="xs:string" use="required" >
			<xs:annotation>
				<xs:documentation>The human-readable string to identify this value. This is what will be manipulated by the XML and shown to the end-user (if applicable).</xs:documentation></xs:annotation></xs:attribute>
		<xs:attribute name="value" type="xs:string" use="required" >
			<xs:annotation>
				<xs:documentation>A system value the 'name' maps to. It will usually not be shown to the end user.</xs:documentation></xs:annotation></xs:attribute>
		<xs:attribute name="color" type="xs:string" use="optional" >
			<xs:annotation>
				<xs:documentation>Optional color attribute to this mapping. This attribute is used in XML-defined views to represent this mapping.</xs:documentation></xs:annotation></xs:attribute>
	</xs:complexType>

	<xs:complexType name="location">
		<xs:annotation>
			<xs:documentation>Define a path in a state system, that can then be used as a shortcut in other XML elements.</xs:documentation></xs:annotation>
		<xs:sequence>
			<xs:element maxOccurs="unbounded" minOccurs="0" name="stateAttribute" type="stateAttribute" >
				<xs:annotation>
					<xs:documentation>Define each element of the path represented by this location. For instance, if location "abc" has path "a/b/c", there would be a sequence of 3 stateAttribute elements of type constant.</xs:documentation></xs:annotation></xs:element>
		</xs:sequence>
		<xs:attribute name="id" type="xs:string" use="required" >
			<xs:annotation>
				<xs:documentation>The identifier of this location, used inside the XML element in the scope of which it is defined.</xs:documentation></xs:annotation></xs:attribute>
		<xs:anyAttribute />
	</xs:complexType>

	<xs:complexType name="mappingGroup">
		<xs:sequence>
			<xs:element maxOccurs="unbounded" name="entry" type="mapEntry" />
		</xs:sequence>
		<xs:attribute name="id" type="xs:string" use="required" />
	</xs:complexType>

	<xs:complexType name="mapEntry">
		<xs:annotation>
			<xs:documentation>Define a handler for a state value. The second state value defined in the handler will be used instead of the first state one whenever it will be met.</xs:documentation></xs:annotation>
		<xs:sequence maxOccurs="1" minOccurs="1">
			<xs:element maxOccurs="2" minOccurs="2" name="stateValue" type="stateValue" />
		</xs:sequence>
	</xs:complexType>

</xs:schema>
