<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://uurage.github.io/ScenarioEditor/config/namespace"
	xmlns:tns="http://uurage.github.io/ScenarioEditor/config/namespace"
	elementFormDefault="qualified"
	version="7.5.0">
	<element name="config">
		<complexType>
			<sequence>
				<element name="settings">
					<complexType>
						<sequence>
							<element name="grid" minOccurs="0" maxOccurs="1">
								<complexType>
								   <attribute name="x" type="int"/>
								   <attribute name="y" type="int"/>
								</complexType>
							</element>
							<element name="statement" minOccurs="0" maxOccurs="1">
								<complexType>
									<sequence>
										<element name="type">
											<complexType>
												<sequence>
													<element ref="tns:string"></element>
												</sequence>
											</complexType>
										</element>
									</sequence>
								</complexType>
							</element>
							<element name="description" minOccurs="0" maxOccurs="1">
								<complexType>
									<sequence>
										<element name="type">
											<complexType>
												<sequence>
													<element ref="tns:string"></element>
												</sequence>
											</complexType>
										</element>
									</sequence>
								</complexType>
							</element>
							<element name="evaluationName" minOccurs="0" maxOccurs="1">
								<complexType>
									<sequence>
										<element name="type">
											<complexType>
												<sequence>
													<element ref="tns:string"></element>
												</sequence>
											</complexType>
										</element>
									</sequence>
								</complexType>
							</element>
							<element name="evaluationDescription" minOccurs="0" maxOccurs="1">
								<complexType>
									<sequence>
										<element name="type">
											<complexType>
												<sequence>
													<element ref="tns:string"></element>
												</sequence>
											</complexType>
										</element>
									</sequence>
								</complexType>
							</element>
							<element name="languages" minOccurs="0" maxOccurs="1">
								<complexType>
									<sequence>
										<element name="language" minOccurs="1" maxOccurs="unbounded">
											<annotation>
												<documentation>
													Defines a language that is available for the authoring of the scenario.
													The language element content is a display name and the code attribute must be a language code defined by RFC 1766.
												</documentation>
											</annotation>
											<complexType>
												<simpleContent>
													<extension base="string">
														<attribute name="code" type="language"/>
													</extension>
												</simpleContent>
											</complexType>
										</element>
									</sequence>
								</complexType>
							</element>
							<element name="colourKeyEntry" minOccurs="0" maxOccurs="1">
								<complexType>
									<sequence>
										<element name="type">
											<complexType>
												<sequence>
													<element ref="tns:string"></element>
												</sequence>
											</complexType>
										</element>
									</sequence>
								</complexType>
							</element>
						</sequence>
					</complexType>
				</element>
				<element name="properties" type="tns:propertiesType" />
				<element name="parameters" type="tns:parameterType" />
				<choice>
					<element ref="tns:character" />
					<element name="characters">
						<complexType>
							<sequence>
								<element name="properties" type="tns:propertiesType" minOccurs="0" maxOccurs="1" />
								<element name="parameters" type="tns:parameterType" minOccurs="0" maxOccurs="1"/>
								<element ref="tns:character" minOccurs="1" maxOccurs="unbounded" />
							</sequence>
						</complexType>
						<key name="characterID">
							<selector xpath="./tns:character" />
							<field xpath="@id" />
						</key>
					</element>
				</choice>
				<element name="migration" minOccurs="0" maxOccurs="1">
					<annotation>
						<documentation>
							This contains the elements of previous versions of the scenarioLanguage expressed as properties or parameters.
						</documentation>
					</annotation>
					<complexType>
						<sequence>
							<element name="intentProperty" minOccurs="0" maxOccurs="1">
								<annotation>
									<documentation>
										Has a reference to the property that defines the current configuration of intent.
										When included the intent as previously found in scenarios of scenarioLanguage version 3 is converted to the referred property where applicable.
									</documentation>
								</annotation>
								<complexType>
									<attribute name="idref" type="NCName" use="required"></attribute>
								</complexType>
							</element>
						</sequence>
					</complexType>
				</element>
			</sequence>
			<attribute name="id" type="NCName" use="required"></attribute>
			<attribute name="version" type="token" use="optional"></attribute>
		</complexType>
		<key name="propertyID">
			<selector xpath=".//tns:property" />
			<field xpath="@id" />
		</key>
		<key name="parameterID">
			<selector xpath=".//tns:parameter" />
			<field xpath="@id" />
		</key>
		<unique name="sectionID">
			<selector xpath=".//tns:propertySection | .//tns:parameterSection" />
			<field xpath="@id" />
		</unique>
		<keyref name="propertyidref" refer="tns:propertyID">
			<selector xpath=".//tns:intentProperty" />
			<field xpath="@idref" />
		</keyref>
	</element>
	<element name="property">
		<complexType>
			<sequence>
				<element name="description" type="tns:stringWithXMLAttributes" minOccurs="0" maxOccurs="1">
					<annotation>
						<documentation>
							A human-readable description of the definition.
						</documentation>
					</annotation>
				</element>
				<group ref="tns:typeGroup" />
			</sequence>
			<attribute name="id" type="NCName" use="required" />
			<attribute name="name" type="string" use="optional" />
			<attributeGroup ref="tns:propertyScopes" />
		</complexType>
	</element>
	<element name="parameter">
		<complexType>
			<sequence>
				<element name="description" type="tns:stringWithXMLAttributes" minOccurs="0" maxOccurs="1">
					<annotation>
						<documentation>
							A human-readable description of the definition.
						</documentation>
					</annotation>
				</element>
				<group ref="tns:typeGroup" />
			</sequence>
			<attribute name="id" use="required">
				<simpleType>
					<restriction base="NCName">
						<pattern value="([^pt]|[p][^\d]|t.).*"/>
					</restriction>
				</simpleType>
			</attribute>
			<attribute name="name" type="string" use="optional" />
			<attributeGroup ref="tns:parameterScopes" />
		</complexType>
	</element>
	<element name="character">
		<complexType>
			<sequence>
				<element name="properties" type="tns:propertiesType" minOccurs="0" maxOccurs="1" />
				<element name="parameters" type="tns:parameterType" minOccurs="0" maxOccurs="1"/>
			</sequence>
			<attribute name="id" type="NCName" use="required" />
			<attribute name="name" type="string" use="optional" />
		</complexType>
	</element>
	<complexType name="propertiesType">
		<choice minOccurs="0" maxOccurs="unbounded">
			<element ref="tns:property" />
			<element name="propertyGroup" type="tns:propertiesType" />
			<element name="propertySection">
				<complexType>
					<complexContent>
						<extension base="tns:propertiesType">
							<attribute name="id" type="NCName" use="optional" />
							<attribute name="name" type="string" use="optional" />
						</extension>
					</complexContent>
				</complexType>
			</element>
		</choice>
		<attributeGroup ref="tns:propertyScopes" />
	</complexType>
	<complexType name="parameterType">
		<choice minOccurs="0" maxOccurs="unbounded">
			<element ref="tns:parameter" />
			<element name="parameterGroup" type="tns:parameterType" />
			<element name="parameterSection">
				<complexType>
					<complexContent>
						<extension base="tns:parameterType">
							<attribute name="id" type="NCName" use="optional" />
							<attribute name="name" type="string" use="optional" />
						</extension>
					</complexContent>
				</complexType>
			</element>
		</choice>
		<attributeGroup ref="tns:parameterScopes" />
	</complexType>
	<complexType name="stringWithXMLAttributes">
		<simpleContent>
			<extension base="string">
				<anyAttribute namespace="http://www.w3.org/XML/1998/namespace" processContents="lax" />
			</extension>
		</simpleContent>
	</complexType>
	<complexType name="type">
		<choice>
			<element name="boolean">
				<complexType>
					<sequence>
						<element name="default" type="boolean" minOccurs="0" maxOccurs="1"/>
					</sequence>
				</complexType>
			</element>
			<element ref="tns:string"></element>
			<element name="integer">
				<complexType>
					<sequence>
						<element name="default" type="int" minOccurs="0" maxOccurs="1"/>
					</sequence>
					<attribute name="minimum" type="int" use="optional"></attribute>
					<attribute name="maximum" type="int" use="optional"></attribute>
				</complexType>
			</element>
			<element name="enumeration">
				<complexType>
					<sequence>
						<element name="option" minOccurs="1" maxOccurs="unbounded">
							<complexType>
								<simpleContent>
									<extension base="string">
										<attribute name="value" type="NCName" use="optional" />
									</extension>
								</simpleContent>
							</complexType>
						</element>
						<element name="default" minOccurs="0" maxOccurs="1">
							<complexType>
								<simpleContent>
									<extension base="string">
										<attribute name="value" type="NCName" use="optional" />
									</extension>
								</simpleContent>
							</complexType>
						</element>
					</sequence>
				</complexType>
			</element>
			<element name="list">
				<complexType>
					<sequence>
						<element name="itemType" type="tns:type" />
						<element name="default" minOccurs="0" maxOccurs="1">
							<complexType>
								<sequence>
									<element name="item" type="anyType" minOccurs="0" maxOccurs="unbounded" />
								</sequence>
							</complexType>
						</element>
					</sequence>
				</complexType>
			</element>
		</choice>
	</complexType>
	<group name="typeGroup">
		<sequence>
			<element name="type" type="tns:type" />
		</sequence>
	</group>
	<element name="string">
		<complexType>
			<sequence>
				<element name="default" type="string" minOccurs="0" maxOccurs="1"/>
			</sequence>
			<attribute name="rows" type="int" use="optional" default="1"></attribute>
			<attribute name="maxLength" type="int" use="optional"></attribute>
			<attribute name="autoComplete" type="boolean" use="optional"></attribute>
			<attribute name="markdown" type="string" use="optional" default="gfm">
				<annotation>
					<documentation>
						If present, the string is eligible for markdown rendering.
						The value of the attribute is used to pick a flavor and can be empty.
					</documentation>
				</annotation>
			</attribute>
		</complexType>
	</element>
	<attributeGroup name="propertyScopes">
		<attribute name="statementScope" use="optional" default="independent">
			<simpleType>
				<restriction base="string">
					<enumeration value="independent" />
					<enumeration value="per" />
					<enumeration value="per-player" />
					<enumeration value="per-situation" />
					<enumeration value="per-computer" />
					<enumeration value="per-computer-own"/>
				</restriction>
			</simpleType>
		</attribute>
	</attributeGroup>
	<attributeGroup name="parameterScopes">
		<attribute name="statementScope" use="optional" default="per">
			<simpleType>
				<restriction base="string">
					<enumeration value="per" />
					<enumeration value="per-player" />
					<enumeration value="per-situation" />
					<enumeration value="per-computer" />
					<enumeration value="per-computer-own"/>
				</restriction>
			</simpleType>
		</attribute>
	</attributeGroup>
</schema>
