<?xml version="1.0" encoding="utf-8"?>
<xs:schema 
	id="PublishingReport"
	targetNamespace="http://platform.point2.com/schemas/2.0/publishingReport"
	xmlns:xs="http://www.w3.org/2001/XMLSchema" 
	xmlns="http://platform.point2.com/schemas/2.0/publishingReport" 
	elementFormDefault="qualified">

	<xs:annotation>
		<xs:documentation>
			This schema outlines the structure of a response document published by a Partner for processing by Point2.  Every response document received by Point2 is checked for
			validity.  A valid document is one that is formally valid according to this XML schema and meets the additional requirements contained in the xs:documentation. If a
			Partner fails to deliver a valid response document once every 72 hours Point2 will stop updating their feed.  A Partner can request that their feed be updated regularily
			once again using the Point2 Platform web site at http://platform.point2.com/account.
		</xs:documentation>
	</xs:annotation>

	<xs:element name="PublishingReport">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="PublishDate" type="xs:dateTime">
					<xs:annotation>
						<xs:documentation>Point2's validation will check that a timezone is specified.</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="Listings">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Listing" type="PublishingReportListing" maxOccurs="unbounded"/>
						</xs:sequence>
					</xs:complexType>
					<xs:key name="ListingID_Unique">
						<xs:selector xpath="./Listing"/>
						<xs:field xpath="./ListingID"/>
					</xs:key>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	
	<xs:complexType name="PublishingReportListing">
		<xs:annotation>
			<xs:documentation>Point2's validation will check that either ErrorMessage or Link is provided.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="ListingID" type="xs:int">
				<xs:annotation>
					<xs:documentation>Point2's validation will check that this ListingID corresponds to a listing contained in the most recent data feed.  </xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="ErrorMessage" minOccurs="0">
				<xs:complexType>
					<xs:simpleContent>
						<xs:annotation>
							<xs:documentation>A human-readable error message.</xs:documentation>
						</xs:annotation>
						<xs:extension base="xs:string">
							<xs:attribute name="code" type="Code">
								<xs:annotation>
									<xs:documentation>A machine-readable error code.</xs:documentation>
								</xs:annotation>
							</xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="Link" minOccurs="0" type="xs:string">
				<xs:annotation>
					<xs:documentation>Point2 will periodically check Links provided here to ensure they respond to an HTTP GET with a nonblank body and response code of 200.  Our crawler uses the agent string "Point2 Platform PublishingReport Validator" and respects 301 and 302 redirects.</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>

	<xs:simpleType name="Code">
		<xs:restriction base="xs:string">
			<xs:enumeration value="400">
				<xs:annotation>
					<xs:documentation>Bad Request - This error occurs if the Order was incorrectly formatted, or otherwise uninterperatable.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="402">
				<xs:annotation>
					<xs:documentation>Insufficient Data - The listing data sent did not include some field that is required (zipcode, state, etc.)</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="500">
				<xs:annotation>
					<xs:documentation>Internal Server Error - An unknown error occured while processing this listing.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="501">
				<xs:annotation>
					<xs:documentation>Unknown Geographic Location - The listing is listed in a location that is not known to the receiving system.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="502">
				<xs:annotation>
					<xs:documentation>No coverage for specified area - The listing is lited in a location that is not supported by the receiving system.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="503">
				<xs:annotation>
					<xs:documentation>Listing Type Not Supported - The listing type is not supported by the receiving system.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="504">
				<xs:annotation>
					<xs:documentation>Listing Status Not Supported - The listing status is not supported by the receiving system.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="505">
				<xs:annotation>
					<xs:documentation>Listing Duplicate - The listing is a duplicate of a listing already present in the receiver's system.  The sender's listing data was not imported.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
		</xs:restriction>
	</xs:simpleType>

</xs:schema>
