<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	elementFormDefault="qualified">
	<xs:element name="RESOURCE_PROFILE">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="HEADER" />
				<xs:element ref="BODY" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="HEADER">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="RESOURCE_IDENTIFIER" />
				<xs:element ref="RESOURCE_TYPE" />
				<xs:element ref="RESOURCE_KIND" />
				<xs:element ref="RESOURCE_URI" />
				<xs:element ref="DATE_OF_CREATION" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="RESOURCE_IDENTIFIER">
		<xs:complexType>
			<xs:attribute name="value" use="required" />
		</xs:complexType>
	</xs:element>
	<xs:element name="RESOURCE_TYPE">
		<xs:complexType>
			<xs:attribute name="value" use="required" fixed="WorkflowDSResourceType" />
		</xs:complexType>
	</xs:element>
	<xs:element name="RESOURCE_KIND">
		<xs:complexType>
			<xs:attribute name="value" use="required" fixed="WorkflowDSResources" />
		</xs:complexType>
	</xs:element>
	<xs:element name="RESOURCE_URI">
		<xs:complexType>
			<xs:attribute name="value" use="required" />
		</xs:complexType>
	</xs:element>
	<xs:element name="DATE_OF_CREATION">
		<xs:complexType>
			<xs:attribute name="value" use="required" type="xs:dateTime" />
		</xs:complexType>
	</xs:element>
	<xs:element name="BODY">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="WORKFLOW_NAME" type="xs:string" />
				<xs:element name="WORKFLOW_INFO" minOccurs="0" maxOccurs="1">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="FIELD" minOccurs="0" maxOccurs="unbounded">
								<xs:complexType>
									<xs:simpleContent>
										<xs:extension base="xs:string">
											<xs:attribute name="name" use="required" type="xs:string"/>
										</xs:extension>
									</xs:simpleContent>
								</xs:complexType>
							</xs:element>
						</xs:sequence>	
					</xs:complexType>
				</xs:element>
				<xs:element name="WORKFLOW_TYPE" type="xs:string" />
				<xs:element name="WORKFLOW_PRIORITY">
					<xs:simpleType>
						<xs:restriction base="xs:integer">
							<xs:minInclusive value="0" />
							<xs:maxInclusive value="100" />
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element ref="CONFIGURATION" />
				<xs:element ref="STATUS" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="WORKFLOW_NAME" type="xs:string" />
	<xs:element name="CONFIGURATION">
		<xs:complexType>
			<xs:sequence>
				<xs:element maxOccurs="unbounded" ref="NODE" />
			</xs:sequence>
			<xs:attribute name="start" use="required">
				<xs:simpleType>
					<xs:restriction base="xs:NCName">
						<xs:enumeration value="auto" />
						<xs:enumeration value="manual" />
						<xs:enumeration value="disabled" />
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	<xs:element name="NODE">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="DESCRIPTION" />
				<xs:element ref="PARAMETERS" />
				<xs:element ref="ARCS" />
			</xs:sequence>
			<xs:attribute name="isStart" use="optional" type="xs:boolean" />
			<xs:attribute name="isJoin" use="optional" type="xs:boolean" />
			<xs:attribute name="name" use="required" type="xs:NCName" />
			<xs:attribute name="type" use="optional" type="xs:NCName" />
		</xs:complexType>
	</xs:element>
	<xs:element name="DESCRIPTION" type="xs:string" />
	<xs:element name="PARAMETERS">
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="PARAM" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="PARAM">
		<xs:complexType mixed="true">
			<xs:simpleContent>
				<xs:extension base="xs:string">
					<xs:attribute name="name" use="required" type="xs:NCName" />
					<xs:attribute name="required" use="optional" type="xs:boolean" />
					<xs:attribute name="managedBy" use="required">
						<xs:simpleType>
							<xs:restriction base="xs:NCName">
								<xs:enumeration value="user" />
								<xs:enumeration value="system" />
							</xs:restriction>
						</xs:simpleType>
					</xs:attribute>
					<xs:attribute name="type" use="optional">
						<xs:simpleType>
							<xs:restriction base="xs:NCName">
								<xs:enumeration value="int" />
								<xs:enumeration value="boolean" />
								<xs:enumeration value="float" />
								<xs:enumeration value="string" />
								<xs:enumeration value="date" />
								<xs:enumeration value="datetime" />
								<xs:enumeration value="property" />
							</xs:restriction>
						</xs:simpleType>
					</xs:attribute>
					<xs:attribute name="function" use="optional" type="xs:string" />
					<xs:attribute name="category" use="optional" type="xs:string" />
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>
	<xs:element name="ARCS">
		<xs:complexType>
			<xs:sequence>
				<xs:element maxOccurs="unbounded" ref="ARC" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="ARC">
		<xs:complexType>
			<xs:attribute name="name" use="optional" type="xs:string" />
			<xs:attribute name="to" use="required" type="xs:NCName" />
		</xs:complexType>
	</xs:element>

	<xs:element name="STATUS">
		<xs:complexType>
			<xs:sequence minOccurs="0">
				<xs:element name="LAST_EXECUTION_ID" type="xs:string" />
				<xs:element name="LAST_EXECUTION_DATE" type="xs:dateTime" />
				<xs:element name="LAST_EXECUTION_STATUS" type="xs:NCName" />
				<xs:element name="LAST_EXECUTION_ERROR" type="xs:string" />
				<xs:element name="LAST_EXECUTION_OUTPUT" minOccurs="0" maxOccurs="unbounded">
					<xs:complexType>
						<xs:simpleContent>
							<xs:extension base="xs:string">
								<xs:attribute name="name" type="xs:string" use="required" />
							</xs:extension>
						</xs:simpleContent>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	
</xs:schema>
