<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://schemas.microsoft.com/windows/2006/08/wdp/scan"
           xmlns:wscn="http://schemas.microsoft.com/windows/2006/08/wdp/scan"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           elementFormDefault="qualified">

    <xs:annotation>
        <xs:documentation>
            WSD Scanning - Job Object schema
            Copyright 2005-2006 Microsoft Corp. All rights reserved
        </xs:documentation>
    </xs:annotation>

    <xs:include schemaLocation="Document.xsd"/>
    <xs:annotation>
        <xs:documentation>Job Element definition</xs:documentation>
    </xs:annotation>
    <xs:complexType name="JobTableType">
        <xs:sequence>
            <xs:element name="ActiveJobs" type="wscn:ListOfJobsType"/>
            <xs:element name="JobHistory" type="wscn:ListOfJobsType" minOccurs="0" />
            <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:complexType>
    <xs:complexType name="JobType">
        <xs:sequence>
            <xs:element name="JobStatus" type="wscn:JobStatusType"/>
            <xs:element name="ScanTicket" type="wscn:ScanTicketType"/>
            <xs:element name="Documents" type="wscn:DocumentsType" minOccurs="0"/>
            <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:complexType>
    <xs:complexType name="ListOfJobsType">
        <xs:sequence>
            <xs:element name="Job" type="wscn:JobType" minOccurs="0" maxOccurs="unbounded"/>
            <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:complexType>
    <xs:complexType name="JobSummaryType">
        <xs:sequence>
            <xs:element name="JobId" type="wscn:IntOneExtType"/>
            <xs:element name="JobName" type="wscn:String255ExtType"/>
            <xs:element name="JobOriginatingUserName" type="wscn:String255ExtType"/>
            <xs:element name="JobState" type="wscn:JobStateType"/>
            <xs:element name="JobStateReasons" type="wscn:JobStateReasonsType" minOccurs="0"/>
            <xs:element name="ScansCompleted" type="wscn:IntZeroExtType"/>
            <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:complexType>
    <xs:complexType name="ListOfSummarysType">
        <xs:sequence>
            <xs:element name="JobSummary" type="wscn:JobSummaryType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:complexType>

    <xs:annotation>
        <xs:documentation>Job Description Element definition</xs:documentation>
    </xs:annotation>
    <xs:complexType name="JobDescriptionType">
        <xs:sequence>
            <xs:element name="JobName" type="wscn:String255ExtType"/>
            <xs:element name="JobOriginatingUserName" type="wscn:String255ExtType"/>
            <xs:element name="JobInformation" type="wscn:String255ExtType" minOccurs="0"/>
            <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:complexType>

    <xs:annotation>
        <xs:documentation>Job Status Element definition</xs:documentation>
    </xs:annotation>
    <xs:complexType name="JobStatusType">
        <xs:sequence>
            <xs:element name="JobId" type="wscn:IntOneExtType"/>
            <xs:element name="JobState" type="wscn:JobStateType"/>
            <xs:element name="JobStateReasons" type="wscn:JobStateReasonsType" minOccurs="0"/>
            <xs:element name="ScansCompleted" type="wscn:IntZeroExtType"/>
            <xs:element name="JobCreatedTime" type="wscn:DateTimeExtType" minOccurs="0"/>
            <xs:element name="JobCompletedTime" type="wscn:DateTimeExtType" minOccurs="0"/>
            <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:complexType>
    <xs:annotation>
        <xs:documentation>Job Status specific semantic elements</xs:documentation>
    </xs:annotation>
    <xs:complexType name="JobStateType">
        <xs:simpleContent>
            <xs:extension base="wscn:JobStateBaseType">
                <xs:anyAttribute namespace="##other" processContents="lax"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:simpleType name="JobStateBaseType">
        <xs:union memberTypes="wscn:JobStateWKVType wscn:KeywordNsExtensionPatternType"/>
    </xs:simpleType>
    <xs:complexType name="JobStateReasonsType">
        <xs:sequence>
            <xs:element name="JobStateReason" type="wscn:JobStateReasonType" maxOccurs="unbounded">
            </xs:element>
        </xs:sequence>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:complexType>
    <xs:complexType name="JobStateReasonType">
        <xs:simpleContent>
            <xs:extension base="wscn:JobStateReasonBaseType">
                <xs:anyAttribute namespace="##other" processContents="lax"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:simpleType name="JobStateReasonBaseType">
        <xs:union memberTypes="wscn:JobStateReasonWKVType wscn:KeywordNsExtensionPatternType"/>
    </xs:simpleType>

    <xs:annotation>
        <xs:documentation>Scan Ticket Element definition</xs:documentation>
    </xs:annotation>
    <xs:complexType name="ScanTicketType">
        <xs:sequence>
            <xs:element name="JobDescription" type="wscn:JobDescriptionType"/>
            <xs:element name="DocumentParameters" type="wscn:DocumentParametersType" minOccurs="0"/>
            <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:complexType>

    <xs:annotation>
        <xs:documentation>Any element name in any namespace</xs:documentation>
    </xs:annotation>
    <xs:simpleType name="JobElementsEntryWKVType">
        <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="JobStatus"/>
            <xs:enumeration value="ScanTicket"/>
            <xs:enumeration value="Document"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="JobElementsEntryType">
        <xs:union memberTypes="wscn:JobElementsEntryWKVType wscn:KeywordNsExtensionPatternType"/>
    </xs:simpleType>
    <xs:complexType name="RequestedJobElementsType">
        <xs:sequence>
            <xs:element name="Name" type="wscn:JobElementsEntryType" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:complexType>

    <xs:complexType  name="JobElementDataType">
        <xs:choice>
            <xs:element name="JobStatus" type="wscn:JobStatusType"/>
            <xs:element name="ScanTicket" type="wscn:ScanTicketType"/>
            <xs:element name="Documents" type="wscn:DocumentsType"/>
            <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="Name" type="xs:QName" use="required" />
        <xs:attribute name="Valid" type="xs:boolean" use="required" />
        <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:complexType>

    <xs:complexType name="JobElementsType">
        <xs:sequence>
            <xs:element name="ElementData" type="wscn:JobElementDataType" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>Attribute: Name
Attribute: Valid</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:complexType>

</xs:schema>

