<?xml version="1.0" encoding="UTF-8"?>
<!--
  The native import feed (40.6): one <item> per listing. Only id, title and
  price are required; everything else can also come from the defaults chosen
  in the import wizard. Help: /help/help-import
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:element name="rariteo-import">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="item" type="Item" minOccurs="1" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attribute name="version" type="xs:string" fixed="1"/>
    </xs:complexType>
  </xs:element>

  <xs:complexType name="Item">
    <xs:all>
      <!-- your own stable id: importing the same id again skips or updates the draft -->
      <xs:element name="id" type="Id"/>
      <xs:element name="title" type="Title"/>
      <!-- plain text or simple HTML (p, br, strong, em, ul, ol, li); scripts and styles are removed -->
      <xs:element name="description" type="xs:string" minOccurs="0"/>
      <!-- the starting price of an auction, or the price of a fixed-price listing -->
      <xs:element name="price" type="Price"/>
      <xs:element name="buyNowPrice" type="Price" minOccurs="0"/>
      <xs:element name="reservePrice" type="Price" minOccurs="0"/>
      <xs:element name="quantity" type="xs:positiveInteger" minOccurs="0"/>
      <xs:element name="condition" type="Condition" minOccurs="0"/>
      <!-- your category name; you pick a site category for each in the wizard -->
      <xs:element name="category" type="Short" minOccurs="0"/>
      <xs:element name="images" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <!-- an https/http address, or a file name inside the uploaded ZIP; at most 12 -->
            <xs:element name="image" type="Short" maxOccurs="12"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:all>
  </xs:complexType>

  <xs:simpleType name="Id">
    <xs:restriction base="xs:string">
      <xs:minLength value="1"/>
      <xs:maxLength value="100"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="Title">
    <xs:restriction base="xs:string">
      <xs:minLength value="1"/>
      <xs:maxLength value="120"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="Short">
    <xs:restriction base="xs:string">
      <xs:minLength value="1"/>
      <xs:maxLength value="300"/>
    </xs:restriction>
  </xs:simpleType>

  <!-- a decimal with a dot, in the currency chosen in the wizard -->
  <xs:simpleType name="Price">
    <xs:restriction base="xs:decimal">
      <xs:minExclusive value="0"/>
      <xs:fractionDigits value="2"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="Condition">
    <xs:restriction base="xs:string">
      <xs:enumeration value="mint"/>
      <xs:enumeration value="excellent"/>
      <xs:enumeration value="good"/>
      <xs:enumeration value="fair"/>
      <xs:enumeration value="poor"/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>
