<?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: Export Promotions - request schema</xs:documentation>
    <xs:documentation>Retrieve details of Promotions.  Filters can be specified where required to limit the results being returned.</xs:documentation>
    <xs:documentation>Version 1.0 : 2017-05-14.  Initial schema creation.</xs:documentation>
    <xs:documentation>Version 1.1 : 2018-04-18.  Company key is now optional as it is provided in the REST url (though required for WCF).</xs:documentation>
  </xs:annotation>
  <xs:element name="export">
    <xs:complexType>
      <xs:all>
        <xs:element minOccurs="0" maxOccurs="1" name="pagination">
          <xs:complexType>
            <xs:all>
              <xs:element minOccurs="0" maxOccurs="1" name="page">
                <xs:annotation>
                  <xs:documentation>The page number of the page of results to be returned.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:integer">
                    <xs:minInclusive value="1" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element minOccurs="0" maxOccurs="1" name="pagesize">
                <xs:annotation>
                  <xs:documentation>The number of items to be returned in a page.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:integer">
                    <xs:maxInclusive value="500" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
            </xs:all>
          </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" maxOccurs="1" name="filters">
          <xs:complexType>
            <xs:all>
              <xs:element minOccurs="0" maxOccurs="1" name="id">
                <xs:annotation>
                  <xs:documentation>Where applicable, a Promotion ID can be provided for filtering the resultset.  Ids are allocated to promotions by Promo when they are created.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:union>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:length value="0" />
                      </xs:restriction>
                    </xs:simpleType>
                    <xs:simpleType>
                      <xs:restriction base="xs:integer" />
                    </xs:simpleType>
                  </xs:union>
                </xs:simpleType>
              </xs:element>
              <xs:element minOccurs="0" maxOccurs="1" name="name">
                <xs:annotation>
                  <xs:documentation>Where applicable a Promotion Name can be provided for filtering the resultset.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="1000" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element minOccurs="0" maxOccurs="1" name="yourref">
                <xs:annotation>
                  <xs:documentation>Where applicable a 'Your Reference' value can be provided for filtering the resultset.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="100" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element minOccurs="0" maxOccurs="1" name="type">
                <xs:annotation>
                  <xs:documentation>Where applicable a Promotion type can be provided for filtering the resultset.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:enumeration value="">
                      <xs:annotation>
                        <xs:documentation>An empty value indicates no filter will be applied for this field.</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="NotSpecified">
                      <xs:annotation>
                        <xs:documentation>No filter will be applied for this field.</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="BASKETREDUCTION">
                      <xs:annotation>
                        <xs:documentation>Basket % or Value Off</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="BOGOF">
                      <xs:annotation>
                        <xs:documentation>Buy one get one free</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="BOGOR">
                      <xs:annotation>
                        <xs:documentation>Buy one get one reduced</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="BUNDLE">
                      <xs:annotation>
                        <xs:documentation>Bundle Price</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="PRODUCTSREDUCTION">
                      <xs:annotation>
                        <xs:documentation>Product(s) % or value Off</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="DEAL">
                      <xs:annotation>
                        <xs:documentation>Deal Price</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="DELIVERYREDUCTION">
                      <xs:annotation>
                        <xs:documentation>Delivery Reduction</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="ISSUECOUPON">
                      <xs:annotation>
                        <xs:documentation>Issue Voucher Code</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="ISSUEPOINTS">
                      <xs:annotation>
                        <xs:documentation>Issue Points</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="FREEPRODUCT">
                      <xs:annotation>
                        <xs:documentation>Add Free Product(s)</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="WORKFLOWTRIGGER">
                      <xs:annotation>
                        <xs:documentation>Workflow Trigger</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="MULTIBUY">
                      <xs:annotation>
                        <xs:documentation>Multi-buy</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element minOccurs="0" maxOccurs="1" name="excludeunpublished">
                <xs:annotation>
                  <xs:documentation>Where applicable a flag indicating whether to exclude unpublished promotions can be provided for filtering the resultset.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:union>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:length value="0" />
                      </xs:restriction>
                    </xs:simpleType>
                    <xs:simpleType>
                      <xs:restriction base="xs:boolean" />
                    </xs:simpleType>
                  </xs:union>
                </xs:simpleType>
              </xs:element>
              <xs:element minOccurs="0" maxOccurs="1" name="validfrom">
                <xs:annotation>
                  <xs:documentation>Where applicable a valid from date/time can be provided for filtering the resultset.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:union>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:length value="0" />
                      </xs:restriction>
                    </xs:simpleType>
                    <xs:simpleType>
                      <xs:restriction base="xs:dateTime" />
                    </xs:simpleType>
                  </xs:union>
                </xs:simpleType>
              </xs:element>
              <xs:element minOccurs="0" maxOccurs="1" name="validto">
                <xs:annotation>
                  <xs:documentation>Where applicable a valid to date/time can be provided for filtering the resultset.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:union>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:length value="0" />
                      </xs:restriction>
                    </xs:simpleType>
                    <xs:simpleType>
                      <xs:restriction base="xs:dateTime" />
                    </xs:simpleType>
                  </xs:union>
                </xs:simpleType>
              </xs:element>
              <xs:element minOccurs="0" maxOccurs="1" name="reportingcode">
                <xs:annotation>
                  <xs:documentation>Where applicable a Reporting Code can be provided for filtering the resultset.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="50" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element minOccurs="0" maxOccurs="1" name="group">
                <xs:annotation>
                  <xs:documentation>Where applicable a Promotion Group can be provided for filtering the resultset.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="1000" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element minOccurs="0" maxOccurs="1" name="onlyactivenow">
                <xs:annotation>
                  <xs:documentation>Where specified, filter the returned list to only include those currently active</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:union>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:length value="0" />
                      </xs:restriction>
                    </xs:simpleType>
                    <xs:simpleType>
                      <xs:restriction base="xs:boolean" />
                    </xs:simpleType>
                  </xs:union>
                </xs:simpleType>
              </xs:element>
            </xs:all>
            <xs:attribute name="matchexact" use="optional">
              <xs:annotation>
                <xs:documentation>Where required, a boolean value can be provided to indicate whether to look for exact matches for all specified criteria filters.</xs:documentation>
              </xs:annotation>
              <xs:simpleType>
                <xs:union>
                  <xs:simpleType>
                    <xs:restriction base="xs:string">
                      <xs:length value="0" />
                    </xs:restriction>
                  </xs:simpleType>
                  <xs:simpleType>
                    <xs:restriction base="xs:boolean" />
                  </xs:simpleType>
                </xs:union>
              </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="lowpriority" type="xs:boolean" use="optional">
              <xs:annotation>
                <xs:documentation>Flag for internal system use only</xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:all>
      <xs:attribute name="companykey" 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:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="200" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:anyAttribute processContents="skip" />
    </xs:complexType>
  </xs:element>
</xs:schema>