<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:documentation>Title: Product Import Schema</xs:documentation>
    <xs:documentation>Provide a list of products to be inserted, updated or deleted.  When supplying a productcode, the variantcode can also be supplied if required.</xs:documentation>
    <xs:documentation>Version 1.0 : 2014-07-14.  Initial schema creation.</xs:documentation>
    <xs:documentation>Version 1.1 : 2014-08-01.  Updates after restructuring of attribute data.</xs:documentation>
    <xs:documentation>Version 1.2 : 2017-01-09.  Updates to include max field lengths and descriptions.</xs:documentation>
    <xs:documentation>Version 1.3 : 2017-03-20.  Minor validation corrections.</xs:documentation>
    <xs:documentation>Version 1.4 : 2018-04-18.  Company key is now optional as it is provided in the REST url (though required for WCF).</xs:documentation>
    <xs:documentation></xs:documentation>
  </xs:annotation>
  <xs:element name="import">
    <xs:complexType>
      <xs:all>
        <xs:element minOccurs="0" maxOccurs="1" name="products">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="0" maxOccurs="1000" name="product">
                <xs:complexType>
                  <xs:all>
                    <xs:element minOccurs="0" maxOccurs="1" name="description" type="xs:string">
                      <xs:annotation>
                        <xs:documentation>A short description of the product.</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                    <xs:element minOccurs="0" maxOccurs="1" name="imageurl" type="xs:string">
                      <xs:annotation>
                        <xs:documentation>Where available a URL to an image for the product.</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                    <xs:element minOccurs="0" maxOccurs="1" name="attributes">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element minOccurs="0" maxOccurs="unbounded" name="attribute">
                            <xs:annotation>
                              <xs:documentation>The node inner text contains the attribute value</xs:documentation>
                            </xs:annotation>
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:string">
                                  <xs:attribute name="name" use="required">
                                    <xs:annotation>
                                      <xs:documentation>The attribute name/token against which the value is defined.</xs:documentation>
                                    </xs:annotation>
                                    <xs:simpleType>
                                      <xs:restriction base="xs:string">
                                        <xs:minLength value="1" />
                                        <xs:maxLength value="200" />
                                      </xs:restriction>
                                    </xs:simpleType>
                                  </xs:attribute>
                                  <xs:attribute name="display" use="optional">
                                    <xs:annotation>
                                      <xs:documentation>Where available, a display version of the value.</xs:documentation>
                                    </xs:annotation>
                                    <xs:simpleType>
                                      <xs:restriction base="xs:string">
                                        <xs:maxLength value="200" />
                                      </xs:restriction>
                                    </xs:simpleType>
                                  </xs:attribute>
                                  <xs:attribute name="deleted" type="xs:boolean" use="optional">
                                    <xs:annotation>
                                      <xs:documentation>Flag indicating whether the attribute value should be deleted.</xs:documentation>
                                    </xs:annotation>
                                  </xs:attribute>
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:all>
                  <xs:attribute name="productcode" use="required">
                    <xs:annotation>
                      <xs:documentation>The primary reference for the product.  Can optionally be used in combination with a Variant Code.  A Product Code (or Product Code/Variant Code) combination must be unique.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:minLength value="1" />
                        <xs:maxLength value="200" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="variantcode" use="optional">
                    <xs:annotation>
                      <xs:documentation>A Variant Code can optionally be used in conjunction with the Product Code.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="200" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="barcode" use="optional">
                    <xs:annotation>
                      <xs:documentation>A barcode for the product.  Not used in product identification.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="200" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="price" type="xs:decimal" use="optional">
                    <xs:annotation>
                      <xs:documentation>An indicative selling price for the product.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="deleted" type="xs:boolean" use="optional">
                    <xs:annotation>
                      <xs:documentation>Flag indicating whether the product should be deleted.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="persistattributes" type="xs:boolean" use="optional">
                    <xs:annotation>
                      <xs:documentation>Flag indicating whether existing attributes defined against the product should be persisted when they are not specified with the product being imported.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:all>
      <xs:attribute name="companykey" type="xs:string" use="optional">
        <xs:annotation>
          <xs:documentation>The company key assigned to your company.  To view the company key navigate to Configuration / Manage Company.</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:anyAttribute processContents="skip" />
    </xs:complexType>
  </xs:element>
</xs:schema>