<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="HADOOP_JOB">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="DESCRIPTION"/>
                <xs:element ref="STATIC_CONFIGURATION"/>
                <xs:element ref="JOB_INTERFACE"/>
                <xs:element ref="SCAN" minOccurs="0" maxOccurs="1"/>
            </xs:sequence>
            <xs:attribute name="name" use="required" type="xs:string"/>
            <xs:attribute name="type" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="mapreduce"/>
                        <xs:enumeration value="oozie"/>
                        <xs:enumeration value="admin"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="DESCRIPTION" type="xs:string"/>
    <xs:element name="STATIC_CONFIGURATION">
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="unbounded" ref="PROPERTY"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="PROPERTY">
        <xs:complexType>
            <xs:attribute name="key" use="required" type="xs:NCName"/>
            <xs:attribute name="value" use="required"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="JOB_INTERFACE">
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="unbounded" minOccurs="0" ref="PARAM"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="PARAM">
        <xs:complexType>
            <xs:attribute name="description" use="required"/>
            <xs:attribute name="name" use="required" type="xs:NCName"/>
            <xs:attribute name="required" use="required" type="xs:boolean"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="SCAN">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="FILTERS"/>
                <xs:element ref="FAMILIES"/>
            </xs:sequence>
            <xs:attribute name="caching" use="optional" type="xs:integer"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="FILTERS">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="FILTER" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence><!-- The operator is OPTIONAL, when it is missing the default value is MUST_PASS_ALL -->
            <xs:attribute name="operator" use="optional" type="operatortype"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="FILTER">
        <xs:complexType>
            <xs:attribute name="type" use="required" type="filtertype"/>
            <xs:attribute name="param" type="xs:string" use="optional"/>
            <xs:attribute name="value" type="xs:string" use="optional"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="FAMILIES">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="FAMILY" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="FAMILY">
        <xs:complexType>
            <xs:attribute name="param" use="optional" type="xs:string"/>
            <xs:attribute name="value" use="optional" type="xs:string"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="STATUS">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="LAST_SUBMISSION_DATE"/>
                <xs:element ref="RUNNING_INSTANCES"/>
                <xs:element ref="CUMULATIVE_RUN"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="LAST_SUBMISSION_DATE">
        <xs:complexType>
            <xs:attribute name="value" use="required" type="xs:dateTime"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="RUNNING_INSTANCES">
        <xs:complexType>
            <xs:attribute name="value" use="required" type="xs:integer"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="CUMULATIVE_RUN">
        <xs:complexType>
            <xs:attribute name="value" use="required" type="xs:integer"/>
        </xs:complexType>
    </xs:element>
    <xs:simpleType name="filtertype">
        <xs:restriction base="xs:string">
            <xs:enumeration value="prefix"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="operatortype">
        <xs:restriction base="xs:string">
            <xs:enumeration value="MUST_PASS_ALL"/>
            <xs:enumeration value="MUST_PASS_ONE"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>
