<?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 name="HEADER" type="HEADERType" />
				<xs:element name="BODY" type="BODYType" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:complexType name="HEADERType">
		<xs:all>
			<xs:element name="RESOURCE_IDENTIFIER" type="RESOURCE_IDENTIFIERType" />
			<xs:element name="RESOURCE_TYPE" type="RESOURCE_TYPEType" />
			<xs:element name="RESOURCE_KIND" type="RESOURCE_KINDType" />
			<xs:element name="RESOURCE_URI" type="RESOURCE_URIType" />
			<xs:element name="DATE_OF_CREATION" type="DATEType" />
		</xs:all>
	</xs:complexType>
	<xs:complexType name="BODYType">
		<xs:sequence>
			<xs:element name="DATAPROVIDER" minOccurs="0" maxOccurs="1">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="id" type="xs:string" use="required" />
							<xs:attribute name="interface" type="xs:string" use="required" />
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>			
			</xs:element>
			
			<xs:element name="METAWORKFLOW_NAME">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
	        				<xs:attribute name="family" type="xs:string" use="required"/>
	        			</xs:extension>
	        		</xs:simpleContent>
        		</xs:complexType>
			</xs:element>
			<xs:element name="METAWORKFLOW_DESCRIPTION" type="xs:string" />
			<xs:element name="METAWORKFLOW_SECTION" type="xs:string"/>
			<xs:element name="ADMIN_EMAIL" type="xs:string"/>
			<xs:element name="CONFIGURATION" type="CONFIGURATIONType" />
			<xs:element name="SCHEDULING" type="SCHEDULINGType" />
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="RESOURCE_IDENTIFIERType">
		<xs:attribute name="value" type="xs:string" use="required" />
	</xs:complexType>
	<xs:complexType name="RESOURCE_TYPEType">
		<xs:attribute name="value" use="required">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="MetaWorkflowDSResourceType" />
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
	</xs:complexType>
	<xs:complexType name="RESOURCE_KINDType">
		<xs:attribute name="value" use="required">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="MetaWorkflowDSResources" />
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
	</xs:complexType>
	<xs:complexType name="RESOURCE_URIType">
		<xs:attribute name="value" type="xs:string" use="required" />
	</xs:complexType>
	<xs:complexType name="DATEType">
		<xs:attribute name="value" type="xs:dateTime" use="required" />
	</xs:complexType>

	<xs:complexType name="CONFIGURATIONType">
		<xs:sequence minOccurs="0" maxOccurs="unbounded">
			<xs:any processContents="skip"/>
		</xs:sequence>
		<xs:attribute name="status" use="required">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="EXECUTABLE" />
					<xs:enumeration value="WAIT_USER_SETTINGS" />
					<xs:enumeration value="WAIT_SYS_SETTINGS" />
					<xs:enumeration value="ASSIGNED" />
					<xs:enumeration value="MISSING" />
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="destroyWorkflow" use="optional" type="xs:string" />
	</xs:complexType>
	
	<xs:complexType name="SCHEDULINGType">
		<xs:sequence>
			<xs:element name="CRON" type="xs:string" />
			<xs:element name="MININTERVAL" type="xs:int" />
		</xs:sequence>
		<xs:attribute name="enabled" use="required" type="xs:boolean" />
	</xs:complexType>

</xs:schema>
