<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:yahoo:merchoffers" xmlns="urn:yahoo:merchoffers" elementFormDefault="qualified">
  <xs:element name="Catalogs">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Catalog" type="CatalogType" minOccurs="0" maxOccurs="5"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:complexType name="CatalogType">
    <xs:sequence>
      <xs:element name="Offers" type="OffersType" minOccurs="0" maxOccurs="1"/>
      <xs:element name="Reviews" type="ReviewsType" minOccurs="0" maxOccurs="1"/>
      <xs:element name="Specs" type="SpecsType" minOccurs="0" maxOccurs="1"/>	
    </xs:sequence>
    <xs:attribute name="ID" type="xs:integer" use="required"/>
    <xs:attribute name="zip" type="xs:string" use="optional"/>
  </xs:complexType>

  <xs:complexType name="OffersType">
    <xs:sequence>
      <xs:element name="Offer" type="OfferType" minOccurs="0" maxOccurs="100"/>
    </xs:sequence>
    <xs:attribute name="totalOffers" type="xs:integer" use="required"/>
  </xs:complexType>

  <xs:complexType name="OfferType">
    <xs:sequence>
      <xs:element name="Merchant" type="MerchantType"/>
      <xs:element name="Url" type="xs:string"/>
      <xs:element name="Condition" type="ConditionType" minOccurs="0"/>
      <xs:element name="Tax" type="TaxShipType" minOccurs="0"/>
      <xs:element name="ShippingCost" type="TaxShipType" minOccurs="0"/>
      <xs:element name="Price" type="PriceType"/>
      <xs:element name="TotalPrice" type="PriceType"/>
      <xs:element name="StrikeThroughPrice" type="PriceType" minOccurs="0"/>
      <xs:element name="Image" type="ImageType" minOccurs="0"/>
      <xs:element name="DisplayMerchant" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="ReviewsType">
    <xs:sequence>
      <xs:element name="Review" type="ReviewType" minOccurs="0" maxOccurs="100"/>
    </xs:sequence>
    <xs:attribute name="firstReviewPosition" type="xs:integer" use="required"/>
    <xs:attribute name="totalReviewsAvailable" type="xs:integer" use="required"/>
    <xs:attribute name="totalReviewsReturned" type="xs:integer" use="required"/>
  </xs:complexType>

  <xs:complexType name="SpecsType">
    <xs:sequence>
      <xs:element name="MinPrice" type="xs:decimal" minOccurs="0"/>
      <xs:element name="MaxPrice" type="xs:decimal" minOccurs="0"/>
      <xs:element name="Thumbnail" type="ImageType" minOccurs="0"/>	
      <xs:element name="Image" type="ImageType" minOccurs="0"/>	
      <xs:element name="LargeImage" type="ImageType" minOccurs="0"/>	
      <xs:element name="ProductName" type="xs:string"/>
      <xs:element name="Description" type="xs:string" minOccurs="0"/>
      <xs:element name="SpecificationList" type="SpecificationListType" minOccurs="0"/>
      <xs:element name="UserRating" type="RatingType" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="MerchantType">
    <xs:sequence>
      <xs:element name="Name" type="xs:string"/>
      <xs:element name="Rating" type="RatingType" minOccurs="0"/>	
      <xs:element name="Logo" type="ImageType" minOccurs="0"/>
    </xs:sequence>
    <xs:attribute name="ID" type="xs:integer" use="required"/>
  </xs:complexType>

  <xs:simpleType name="ConditionType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="new"/>
      <xs:enumeration value="refurbished"/>
      <xs:enumeration value="merchant-marketplace"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="TaxShipType">
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]+.[0-9][0-9]|check merchant"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="PriceType">
    <xs:restriction base="xs:decimal">
      <xs:minInclusive value="0.00"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="ImageType">
    <xs:sequence>
      <xs:element name="Url" type="xs:string"/>
      <xs:element name="Height" type="xs:nonNegativeInteger"/>
      <xs:element name="Width" type="xs:nonNegativeInteger"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="RatingType">
    <xs:sequence>
      <xs:element name="MaxRating" type="RatingValueType"/>
      <xs:element name="NumRatings" type="xs:nonNegativeInteger"/>
      <xs:element name="AverageRating" type="RatingValueType"/>
      <xs:element name="NumReviews" type="xs:nonNegativeInteger" minOccurs="0"/>	
      <xs:element name="RatingUrl" type="xs:string"/>
      <xs:element name="CreateRatingUrl" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

  <xs:simpleType name="RatingValueType">
    <xs:restriction base="xs:decimal">
      <xs:minInclusive value="0.0"/>
      <xs:maxInclusive value="5.0"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="ReviewType">
    <xs:sequence>
      <xs:element name="Title" type="xs:string"/>
      <xs:element name="Reviewer" type="xs:string"/>
      <xs:element name="CreateTime" type="xs:integer"/>
      <xs:element name="HelpfulRecommendations" type="xs:integer"/>
      <xs:element name="TotalRecommendations" type="xs:integer"/>
      <xs:element name="Ratings" type="SubRatingsType" minOccurs="0"/>	
      <xs:element name="OverallRating" type="RatingValueType"/>
      <xs:element name="Pro" type="xs:string"/>
      <xs:element name="Con" type="xs:string"/>
      <xs:element name="Posting" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="SubRatingsType">
    <xs:sequence>
      <xs:element name="Rating" type="SubRatingType" minOccurs="0" maxOccurs="10"/>
    </xs:sequence>
  </xs:complexType>	 

  <xs:complexType name="SubRatingType">
    <xs:simpleContent>
      <xs:extension base="RatingValueType">
        <xs:attribute name="ratingType" type="xs:string" use="required"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="SpecificationListType">
    <xs:sequence>
      <xs:element name="Specification" type="SpecificationType" minOccurs="0" maxOccurs="100"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="SpecificationType">
    <xs:sequence>
      <xs:element name="SpecificationLabel" type="xs:string"/>
      <xs:element name="SpecificationValue" type="xs:string"/>
      <xs:element name="SpecificationCategory" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

</xs:schema>
