<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns="http://www.skatestown.com/ns/po" 
  targetNamespace="http://www.skatestown.com/ns/po" 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<xsd:annotation>
		<xsd:documentation xml:lang="en">
			Purchase order schema for SkatesTown.
		</xsd:documentation>
	</xsd:annotation>
	<xsd:element name="po" type="poType" />
	<xsd:complexType name="poType">
		<xsd:sequence>
			<xsd:element name="billTo" type="addressType" />
			<xsd:element name="shipTo" type="addressType" />
			<xsd:element name="order">
				<xsd:complexType>
					<xsd:sequence>
						<xsd:element name="item" type="itemType" maxOccurs="unbounded" />
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>
		</xsd:sequence>
		<xsd:attribute name="id" use="required" type="xsd:positiveInteger" />
		<xsd:attribute name="submitted" use="required" type="xsd:date" />
		<xsd:attribute name="customerId" use="required" type="xsd:positiveInteger" />
	</xsd:complexType>
	<xsd:complexType name="addressType">
		<xsd:sequence>
			<xsd:element name="name" type="xsd:string" minOccurs="0" />
			<xsd:element name="company" type="xsd:string" minOccurs="0" />
			<xsd:element name="street" type="xsd:string" maxOccurs="unbounded" />
			<xsd:element name="city" type="xsd:string" />
			<xsd:element name="state" type="xsd:string" minOccurs="0" />
			<xsd:element name="postalCode" type="xsd:string" minOccurs="0" />
			<xsd:element name="country" type="xsd:string" minOccurs="0" />
		</xsd:sequence>
		<xsd:attribute name="id" type="xsd:ID" />
		<xsd:attribute name="href" type="xsd:IDREF" />
	</xsd:complexType>
	<xsd:complexType name="itemType">
		<xsd:sequence>
			<xsd:element name="description" type="xsd:string" minOccurs="0" />
		</xsd:sequence>
		<xsd:attribute name="sku" use="required">
			<xsd:simpleType>
				<xsd:restriction base="xsd:string">
					<xsd:pattern value="\d{3}-[A-Z]{2}" />
				</xsd:restriction>
			</xsd:simpleType>
		</xsd:attribute>
		<xsd:attribute name="quantity" use="required" type="xsd:positiveInteger" />
	</xsd:complexType>
</xsd:schema>
