<?xml version="1.0" encoding="UTF-8"?>
<!-- $id: $ -->
<!-- these are types that are used only in the CEA interface definitions -->
<!-- note that the type naming in this file is not really in line with the latest style -->
<xsd:schema targetNamespace="http://www.ivoa.net/xml/CEA/types/v1.0rc1"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"  
 xmlns:ceat="http://www.ivoa.net/xml/CEA/types/v1.0rc1" 
 xmlns:xlink="http://www.w3.org/1999/xlink"
 elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0 $Revision: 1.3 $"
  xmlns:ceab="http://www.ivoa.net/xml/CEA/base/v1.0rc2">
	<xsd:import namespace="http://www.ivoa.net/xml/CEA/base/v1.0rc2" schemaLocation="../v11/CEABase.xsd"></xsd:import>

	<xsd:element name="message" type="ceat:message-type"/>
	<xsd:complexType name="message-type">
		<xsd:annotation>
			<xsd:documentation>A log entry recorded during execution</xsd:documentation>
		</xsd:annotation>
		 <xsd:all>
            <xsd:element name="phase" type="ceat:execution-phase" minOccurs="1">
               <xsd:annotation>
                  <xsd:documentation>
                     The excecution phase that the message occured in.
                  </xsd:documentation>
               </xsd:annotation></xsd:element>           
			<xsd:element name="content" type="xsd:string" minOccurs="0">
			   <xsd:annotation>
			      <xsd:documentation>
			         The human readable content of the message.
			      </xsd:documentation>
			   </xsd:annotation></xsd:element>
			<xsd:element name="source" type="xsd:string" minOccurs="0">
			   <xsd:annotation>
			      <xsd:documentation>
			         a label indicating the source of the message - e.g.
			         module component name and line number in source
			         code.
			      </xsd:documentation>
			   </xsd:annotation></xsd:element>
			<xsd:element name="timestamp" type="xsd:dateTime" minOccurs="0">
			   <xsd:annotation>
			      <xsd:documentation>
			         The time at which the message was issued.
			      </xsd:documentation>
			   </xsd:annotation></xsd:element>
			<xsd:element name="level" type="ceat:log-level" minOccurs="0">
			   <xsd:annotation>
			      <xsd:documentation>
			         signicance level of the message
			      </xsd:documentation>
			   </xsd:annotation></xsd:element>
		</xsd:all>
	</xsd:complexType>
	<xsd:element name="jobId" type="ceat:job-identifier-type">
	   <xsd:annotation>
	      <xsd:documentation>
	         a concrete element containing the job identifier
	      </xsd:documentation>
	   </xsd:annotation></xsd:element>
	<xsd:simpleType name="job-identifier-type">
		<xsd:annotation>
			<xsd:documentation>Element for pass-through activity token</xsd:documentation>
		</xsd:annotation>
		<xsd:restriction base="xsd:string"/>
	</xsd:simpleType>
	<!-- supporting types -->
	<xsd:simpleType name="execution-phase">
   <!-- need to think a little here about the implication of allowing a "re-entrant" application that is capable of running mini-jobs...probably this is indicated with a different state varible entirely -->
		<xsd:annotation>
			<xsd:documentation>Enumeration of possible phases of job  execution</xsd:documentation>
		</xsd:annotation>
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="QUEUED">
				<xsd:annotation>
					<xsd:documentation> An application has been 
								accepted for execution but is waiting in a 
								queue </xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>
			<xsd:enumeration value="PENDING"> <!-- used to be initializing in CEA classic...-->
				<xsd:annotation>
					<xsd:documentation> The first phase - this is where 
								a job is being set up and the parameters being 
								checked </xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>
			<xsd:enumeration value="EXECUTING">
				<xsd:annotation>
					<xsd:documentation> An application is running 
								</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>
			<xsd:enumeration value="COMPLETED">
				<xsd:annotation>
					<xsd:documentation> An application has completed successfully </xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>
			<xsd:enumeration value="ERROR">
				<xsd:annotation>
					<xsd:documentation>
								Some form of error has occured
							</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>
			<xsd:enumeration value="UNKNOWN">
				<xsd:annotation>
					<xsd:documentation>The application is in an unknown state</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>
			<xsd:enumeration value="HELD">
				<xsd:annotation>
					<xsd:documentation>The application is HELD pending execution and will not automatically be executed (cf pending)</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>
			<xsd:enumeration value="SUSPENDED">
				<xsd:annotation>
					<xsd:documentation>The application has been suspended by the system during execution</xsd:documentation>
				</xsd:annotation>
			</xsd:enumeration>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="log-level">
	   <xsd:annotation>
	      <xsd:documentation>
	         Enumeration of possible message log levels.
	      </xsd:documentation>
	   </xsd:annotation>
	   <xsd:restriction base="xsd:string">
	      <xsd:enumeration value="info">
	         <xsd:annotation>
	            <xsd:documentation>
	               a message with only informational content
	            </xsd:documentation>
	         </xsd:annotation>
	      </xsd:enumeration>
	      <xsd:enumeration value="warn">
	         <xsd:annotation>
	            <xsd:documentation>
	               a message that warns about a possible error condition
	            </xsd:documentation>
	         </xsd:annotation>
	      </xsd:enumeration>
	      <xsd:enumeration value="error">
	         <xsd:annotation>
	            <xsd:documentation>
	               a message that informs about a definite error
	               condition
	            </xsd:documentation>
	         </xsd:annotation>
	      </xsd:enumeration>
	   </xsd:restriction>
	</xsd:simpleType>
   <!-- should refactor with the CEABase equivalent -->
	<xsd:complexType name="result-list-type">
		<xsd:sequence>
			<xsd:element name="result" type="ceab:ParameterValue" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>
   <!-- should refactor with the CEABase equivalent -->
	<xsd:complexType name="input-list-type">
		<xsd:sequence>
			<xsd:element name="parameter" type="ceab:ParameterValue" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="execution-summary-type">
		<xsd:all>
			<xsd:element name="application-name" type="xsd:string"/>
			<xsd:element ref="ceat:jobId"/>
			<xsd:element name="input-list" type="ceat:input-list-type"/>
			<xsd:element name="result-list" type="ceat:result-list-type" minOccurs="0"/>
			<xsd:element  ref="ceat:phase"/>
            <xsd:element name="startTime" type="xsd:dateTime"/>
            <xsd:element name="endTime" type="xsd:dateTime"/>
            <xsd:element ref="ceat:termination"/>
		</xsd:all>
	</xsd:complexType>
 
 <!-- elements to use in interfaces --> 
         <xsd:complexType name="CreateJob">
               <xsd:sequence>
                  <xsd:element name="tool" type="ceab:Tool" />
                  <xsd:element name="externalId"
                     type="ceat:job-identifier-type">
                     <xsd:annotation>
                        <xsd:documentation>
                           An external identifier that the caller can
                           use to identify a job.
                        </xsd:documentation>
                     </xsd:annotation>
                  </xsd:element>
               </xsd:sequence>
            </xsd:complexType>
   
   

    <xsd:element name="phase" type="ceat:execution-phase"></xsd:element>

    <xsd:element name="quote" type="xsd:string"></xsd:element>

    <xsd:element name="termination" type="xsd:dateTime"></xsd:element>
</xsd:schema>

