<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://www.ansys.com/ekm/lifecycle"
	xmlns:ekmLifecycle="http://www.ansys.com/ekm/lifecycle"
	xmlns:ekmScript="http://www.ansys.com/ekm/script">

	<xsd:import namespace="http://www.ansys.com/ekm/script" schemaLocation="script.xsd"/>

	<xsd:complexType name="Stage">
		<xsd:sequence>
			<xsd:element name="permission" minOccurs="0"
				maxOccurs="unbounded">
				<xsd:complexType>
					<xsd:sequence>
						<xsd:element name="type" minOccurs="1"
							maxOccurs="unbounded">
							<xsd:simpleType>
								<xsd:restriction base="xsd:string">
									<xsd:enumeration value="access" />
									<xsd:enumeration value="create" />
									<xsd:enumeration value="delete" />
									<xsd:enumeration value="modify" />
									<xsd:enumeration value="download" />
									<xsd:enumeration value="lifecycle" />
									<xsd:enumeration
										value="fullControl" />
								</xsd:restriction>
							</xsd:simpleType>
						</xsd:element>
						<xsd:element name="member" type="xsd:string"
							minOccurs="1" maxOccurs="unbounded" />
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>
		</xsd:sequence>
		<xsd:attribute name="name" type="xsd:string" use="required" />
		<xsd:attribute name="description" type="xsd:string"
			use="required" />
		<xsd:attribute name="demoteAllowed" type="xsd:boolean"
			use="optional" />
		<xsd:attribute name="expirationDays" type="xsd:int" use="optional" />
	</xsd:complexType>

	<xsd:complexType name="Signoff">
		<xsd:attribute name="level" type="xsd:string" use="required" />
		<xsd:attribute name="members" type="xsd:string" use="required" />
		<xsd:attribute name="inclusive" use="optional" type="xsd:boolean" default="true"/>
		<xsd:attribute name="dueDays" use="optional" type="xsd:int" default="7"/>
	</xsd:complexType>

	<xsd:complexType name="Transition">
		<xsd:sequence>
			<xsd:element name="promoteSignoff" type="ekmLifecycle:Signoff" minOccurs="0"
				maxOccurs="unbounded" />
			<xsd:element name="demoteSignoff" type="ekmLifecycle:Signoff" minOccurs="0"
				maxOccurs="unbounded" />
		</xsd:sequence>
		<xsd:attribute name="source" type="xsd:string" use="required" />
		<xsd:attribute name="destination" type="xsd:string"
			use="required" />
		<xsd:attribute name="promoteValidationMacro" type="xsd:string"
			use="optional" />
		<xsd:attribute name="promoteActionMacro" type="xsd:string"
			use="optional" />
		<xsd:attribute name="demoteValidationMacro" type="xsd:string"
			use="optional" />
		<xsd:attribute name="demoteActionMacro" type="xsd:string"
			use="optional" />
	</xsd:complexType>

	<xsd:complexType name="Layout">
		<xsd:sequence>
			<xsd:element name="location" type="ekmLifecycle:Location"
				minOccurs="0" maxOccurs="unbounded" />
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="Location">
		<xsd:attribute name="stageName" type="xsd:string" use="optional" />
		<xsd:attribute name="x" type="xsd:integer" use="optional" />
		<xsd:attribute name="y" type="xsd:integer" use="optional" />
	</xsd:complexType>

	<xsd:complexType name="LifecycleDefinition">
		<xsd:sequence>
		    <xsd:element name="ekmVersion" type="xsd:string" minOccurs="0"/>
			<xsd:element name="script" type="ekmScript:Script" minOccurs="0"/>
		
			<xsd:element name="type" minOccurs="1"
				maxOccurs="unbounded">
				<xsd:complexType>
					<xsd:attribute name="name" type="xsd:string"
						use="required" />
					<xsd:attribute name="enabledByDefault"
						use="required" type="xsd:boolean" />
				</xsd:complexType>
			</xsd:element>

			<xsd:element name="stage" minOccurs="1" maxOccurs="unbounded"
				type="ekmLifecycle:Stage" />

			<xsd:element name="transition" minOccurs="0" maxOccurs="unbounded"
				type="ekmLifecycle:Transition" />

			<xsd:element name="layout" type="ekmLifecycle:Layout"
				minOccurs="0" maxOccurs="1" />

		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="lifecycle"
		type="ekmLifecycle:LifecycleDefinition" />

</xsd:schema>