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

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

	<xsd:complexType name="NameValue">
		<xsd:attribute name="name" type="xsd:string" use="required" />
		<xsd:attribute name="value" type="xsd:string" use="required" />
	</xsd:complexType>	

	<xsd:complexType name="ExportFile" mixed="true">
		<xsd:attribute name="exportedFileName" type="xsd:string" use="optional" />
		<xsd:attribute name="template" type="xsd:boolean" use="optional" />
		<xsd:attribute name="temporary" type="xsd:boolean" use="optional" />
		<xsd:attribute name="nonEkmFile" type="xsd:boolean" use="optional" />
		<xsd:attribute name="includes" type="xsd:string" use="optional" />
		<xsd:attribute name="excludes" type="xsd:string" use="optional" />
	</xsd:complexType>

    <xsd:complexType name="ImportFile" mixed="true">
        <xsd:attribute name="literal" type="xsd:boolean" use="optional" />
        <xsd:attribute name="includes" type="xsd:string" use="optional" />
        <xsd:attribute name="excludes" type="xsd:string" use="optional" />
        <xsd:attribute name="retrieveOnFailure" type="xsd:string" use="optional" />
    </xsd:complexType>
    
	<xsd:complexType name="ImportedFileType">
		<xsd:attribute name="pattern" type="xsd:string" use="required" />
		<xsd:attribute name="type" type="xsd:string" use="required" />
	</xsd:complexType>

	<xsd:complexType name="Variable">
		<xsd:sequence>
			<xsd:element name="enumeration" type="ekmJobTemplate:NameValue"
				minOccurs="0" maxOccurs="unbounded" />
			<xsd:element name="trueValue" type="xsd:string"
				minOccurs="0" maxOccurs="1" />
			<xsd:element name="falseValue" type="xsd:string"
				minOccurs="0" maxOccurs="1" />
			<xsd:element name="pattern" type="xsd:string"
				minOccurs="0" maxOccurs="1" />
		</xsd:sequence>
		<xsd:attribute name="name" type="xsd:string" use="required" />
		<xsd:attribute name="type" use="required">
			<xsd:simpleType>
				<xsd:restriction base="xsd:string">
					<xsd:enumeration value="Double" />
					<xsd:enumeration value="Long" />
					<xsd:enumeration value="String" />
					<xsd:enumeration value="Boolean" />
					<xsd:enumeration value="File" />
					<xsd:enumeration value="Expression" />
				</xsd:restriction>
			</xsd:simpleType>
		</xsd:attribute>
		<xsd:attribute name="value" type="xsd:string" use="required" />
		<xsd:attribute name="label" type="xsd:string" use="optional" />
	</xsd:complexType>
	
	<xsd:complexType name="AppKey">
		<xsd:simpleContent>
			<xsd:extension base="xsd:string">
				<xsd:attribute name="selectableAppKeys" type="xsd:string" use="optional" />
			</xsd:extension>
		</xsd:simpleContent>
	</xsd:complexType>
	
	<xsd:complexType name="Queue">
		<xsd:simpleContent>
			<xsd:extension base="xsd:string">
				<xsd:attribute name="selectableQueues" type="xsd:string" use="optional" />
			</xsd:extension>
		</xsd:simpleContent>
	</xsd:complexType>
    
    <xsd:simpleType name="ViewType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="GENERIC" />
            <xsd:enumeration value="FLUENT" />
            <xsd:enumeration value="MAPDL" />
            <xsd:enumeration value="EMAG" />
            <xsd:enumeration value="CFX" />
        </xsd:restriction>
    </xsd:simpleType>

	<xsd:complexType name="JobTemplate">
		<xsd:sequence>
			<xsd:element name="ekmVersion" type="xsd:string" minOccurs="0"/>
			<xsd:element name="script" type="ekmScript:Script" minOccurs="0"/>
			<xsd:element name="var" type="ekmJobTemplate:Variable" minOccurs="0" maxOccurs="unbounded" />
			<xsd:element name="interactive" type="xsd:boolean"/>
			<xsd:element name="appKey" type="ekmJobTemplate:AppKey"/>
			<xsd:element name="cores" type="xsd:string" minOccurs="0"/>
			<xsd:element name="queue" type="ekmJobTemplate:Queue" minOccurs="0"/>
			<xsd:element name="nativeOptions" type="xsd:string" minOccurs="0"/>
			<xsd:element name="jobName" type="xsd:string" minOccurs="0"/>
			<xsd:element name="param" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
			<xsd:element name="env" minOccurs="0" maxOccurs="unbounded" type="ekmJobTemplate:NameValue" />
			<xsd:element name="remoteOption" minOccurs="0" maxOccurs="unbounded" type="ekmJobTemplate:NameValue" />
			<xsd:element name="transcriptFile" type="xsd:string" minOccurs="0"/>
			<xsd:element name="outputFolder" type="xsd:string" minOccurs="0" />
			<xsd:element name="exportFile" minOccurs="0" maxOccurs="unbounded" type="ekmJobTemplate:ExportFile" />
			<xsd:element name="importFile" minOccurs="0" maxOccurs="unbounded"  type="ekmJobTemplate:ImportFile" />
			<xsd:element name="importedFileType" minOccurs="0" maxOccurs="unbounded" type="ekmJobTemplate:ImportedFileType" />
			<xsd:element name="templateVar" minOccurs="0" maxOccurs="unbounded" type="ekmJobTemplate:NameValue" />
			<xsd:element name="validationMacro" minOccurs="0" maxOccurs="1" type="xsd:string" />
			<xsd:element name="closeSessionOnExit" minOccurs="0" maxOccurs="1" type="xsd:boolean" />
			<xsd:element name="initMacro" minOccurs="0" maxOccurs="1" type="xsd:string" />
            <xsd:element name="memoryPerCore" type="xsd:string" minOccurs="0"/>
            <xsd:element name="nodeExclusive" type="xsd:boolean" minOccurs="0"/>
            <xsd:element name="distributed" type="xsd:boolean" minOccurs="0"/>
			<xsd:element name="showWorkingDirectory" type="xsd:boolean" minOccurs="0"/>
			<xsd:element name="viewType" type="ekmJobTemplate:ViewType" minOccurs="0" maxOccurs="1" />
            <xsd:element name="associatedTypes" type="xsd:string" minOccurs="0" maxOccurs="1" />
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name="jobTemplate" type="ekmJobTemplate:JobTemplate" />

</xsd:schema>