<?xml version="1.0" encoding="UTF-8"?>
<!--
 A Simple Purchase Order for SpecjAppServer Supplier & Buyer communication.
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="org:spec:jent:ws:supplier:PurchaseOrder"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:xmime="http://www.w3.org/2005/05/xmlmime" 
    xmlns:ublo="urn:oasis:names:specification:ubl:schema:xsd:Order-1.0" 
    xmlns:specwsbpo="org:spec:jent:ws:supplier:PurchaseOrder"
    targetNamespace="org:spec:jent:ws:supplier:PurchaseOrder"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    version="1.0">

  <xsd:import namespace="urn:oasis:names:specification:ubl:schema:xsd:Order-1.0" schemaLocation="UBL-Order-1.0.xsd"/>

  <xsd:element name="SimplePurchaseOrder" type="SimplePurchaseOrderType"/>
  <xsd:complexType name="SimplePurchaseOrderType">
	<xsd:sequence>
        <xsd:element name="poNumber" type="xsd:string" />
        <xsd:element name="siteID" type="xsd:string" />
        <xsd:element name="numLines" type="xsd:int" />
	    <xsd:element name="poLines" type="PurchaseOrderLineType" minOccurs="1" maxOccurs="unbounded"/>
	</xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="PurchaseOrderLineType">
	<xsd:sequence>
        <xsd:element name="lineNumber" type="xsd:int" />
        <xsd:element name="partID" type="xsd:string" />
        <xsd:element name="quantity" type="xsd:int" />
        <xsd:element name="location" type="xsd:int" />
        <xsd:element name="balance" type="xsd:float" />
        <xsd:element name="leadTime" type="xsd:int" />
	</xsd:sequence>
  </xsd:complexType>

  <xsd:element name="InlinePurchaseOrder" type="InlinePurchaseOrderType"/>
  <xsd:complexType name="InlinePurchaseOrderType">
	<xsd:sequence>
        <xsd:element name="largeMessage" type="ublo:OrderType" />
        <xsd:element name="smallMessage" type="specwsbpo:SimplePurchaseOrderType" />
	  <xsd:element name="returnURL" type="xsd:string"/>
	</xsd:sequence>
  </xsd:complexType>

  <xsd:element name="PurchaseOrderAttachment" type="PurchaseOrderAttachmentType"/>
  <xsd:complexType name="PurchaseOrderAttachmentType">
	<xsd:sequence>
        <xsd:element name="largeMessage" type="specwsbpo:ListOrderAttachment" />
	  <xsd:element name="attachmentSize" type="xsd:int"/>
        <xsd:element name="smallMessage" type="specwsbpo:SimplePurchaseOrderType" />
  	  <xsd:element name="returnURL" type="xsd:string"/>
	</xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ListOrderAttachment"> 
   <xsd:sequence>
       <xsd:element name="OrderAttachment" type="xsd:base64Binary" xmime:expectedContentTypes="application/octet-stream" minOccurs="1" maxOccurs="unbounded"/>
   </xsd:sequence>
  </xsd:complexType>



</xsd:schema>
