<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://www.cottonxml.org" xmlns="http://www.cottonxml.org"  xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
	<xs:include schemaLocation="Invoice.xsd"/>
	<xs:complexType name="Charge">
		<xs:sequence>
			<xs:element name="StorageRecap" type="StorageRecap" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>The storage recap represents a summary of how long bales were in storage at the warehouse and at what rate they were there for</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Item" type="Item" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The different items associated with the charge.  For Storage charge types, please set the quantity element to the number of bales.  Any storage details should be included in the storage recap.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>This Wildcard allows for any additional elements to be added to the document and they can still be validated against this schema</xs:documentation>
				</xs:annotation>
			</xs:any>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="StorageRecap">
		<xs:sequence>
			<xs:element name="StartDate" type="xs:date" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The date at which storage began accumulating for the bales</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="StopDate" type="xs:date" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The date at which storage stopped accumulating for the bales</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="TotalDaysOrMonths" type="xs:integer" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The Total Number of days or months that are counted against storage.  So TotalDaysOrMonths * Quantity * Rate should equal total</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Quantity" type="xs:int" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The number of bales that were stored for the amount of time described by the Start and Stop dates</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Rate" type="xs:decimal" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The rate at which the storage charges apply</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Total" type="xs:decimal" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The quantity of the bales times the applicable rate times the number of units stored (days or months)</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>This Wildcard allows for any additional elements to be added to the document and they can still be validated against this schema</xs:documentation>
				</xs:annotation>
			</xs:any>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="Shipment">
		<xs:sequence>
			<xs:element name="Charge" type="Charge" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>Any warehouse charges that are associated with the shipment such as storage and loading</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Number" type="xs:string" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The order number assigned to the shipment by the shipper</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Type" type="xs:string" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The type of shipment</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Date" type="xs:date" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The date of the shipment</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Mark" type="xs:string" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The mark assigned to the shipment by the merchangt</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>This Wildcard allows for any additional elements to be added to the document and they can still be validated against this schema</xs:documentation>
				</xs:annotation>
			</xs:any>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="WarehouseInvoice">
		<xs:annotation>
			<xs:documentation>The warehouse invoice type represents an invoice for charges related to shipment of cotton stored at a particular warehouse</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="Invoice">
				<xs:sequence>
					<xs:element name="Shipment" type="Shipment" minOccurs="0" maxOccurs="unbounded">
						<xs:annotation>
							<xs:documentation>Shipments that are associated with warehouse invoices</xs:documentation>
						</xs:annotation>
					</xs:element>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:element name="WarehouseInvoice" type="WarehouseInvoice"/>
</xs:schema>
