<?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 Campaigns/Coupons - response schema</xs:documentation>
    <xs:documentation>Provides campaign/coupon details.</xs:documentation>
    <xs:documentation>Version 1.0 : 2017-10-02.  Initial schema creation.</xs:documentation>
  </xs:annotation>
  <xs:element name="response">
    <xs:complexType>
      <xs:all>
        <xs:element minOccurs="0" maxOccurs="1" name="summary">
          <xs:complexType>
            <xs:all>
              <xs:element minOccurs="0" maxOccurs="1" name="action">
                <xs:annotation>
                  <xs:documentation>The Name of the API service action</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="id" type="xs:integer" use="optional">
                        <xs:annotation>
                          <xs:documentation>The Id of the API service action</xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element minOccurs="0" maxOccurs="1" name="messages">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element minOccurs="0" maxOccurs="unbounded" name="message">
                      <xs:annotation>
                        <xs:documentation>The message text.</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute name="code" type="xs:string" use="optional">
                              <xs:annotation>
                                <xs:documentation>The code associated with the message.</xs:documentation>
                              </xs:annotation>
                            </xs:attribute>
                            <xs:attribute name="for" type="xs:string" use="optional" />
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:all>
            <xs:attribute name="result" type="xs:boolean" use="optional">
              <xs:annotation>
                <xs:documentation>Flag indicating whether the process completed without errors.</xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="filtered" type="xs:boolean" use="optional" />
            <xs:attribute name="processingdate" type="xs:dateTime" use="optional" />
          </xs:complexType>
        </xs:element>
        <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 selected page</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 per page</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:integer">
                    <xs:maxInclusive value="500" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element minOccurs="0" maxOccurs="1" name="totalitemcount" type="xs:integer">
                <xs:annotation>
                  <xs:documentation>The total number of items available to be exported</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element minOccurs="0" maxOccurs="1" name="totalpagecount" type="xs:integer">
                <xs:annotation>
                  <xs:documentation>The total estimated page count, based on the requested page size.</xs:documentation>
                </xs:annotation>
              </xs:element>
            </xs:all>
          </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" maxOccurs="1" name="coupons">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="0" maxOccurs="unbounded" name="coupon">
                <xs:complexType>
                  <xs:all>
                    <xs:element minOccurs="0" maxOccurs="1" name="name" type="xs:string">
                      <xs:annotation>
                        <xs:documentation>The coupon name.</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                    <xs:element minOccurs="0" maxOccurs="1" name="reportingcode" type="xs:string">
                      <xs:annotation>
                        <xs:documentation>Where available, the reporting code assigned to the coupon.</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                    <xs:element minOccurs="0" maxOccurs="1" name="numberseriesname" type="xs:string">
                      <xs:annotation>
                        <xs:documentation>For Voucher type coupons only, and where 'generateusing' is set to 'IncrementNumberSeries', the name of the number series to be used when generating new codes.</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                    <xs:element minOccurs="0" maxOccurs="1" name="mask" type="xs:string">
                      <xs:annotation>
                        <xs:documentation>For Voucher type coupons only, and where 'generateusing' is set to 'Mask', the mask to be used for generating codes.  Masks can contain constants and replacement characters - where replacement characters support the insertion of randomized alphanumeric, numeric or special characters.</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                    <xs:element minOccurs="0" maxOccurs="1" name="statistics">
                      <xs:complexType>
                        <xs:attribute name="codescount" type="xs:integer" use="optional">
                          <xs:annotation>
                            <xs:documentation>The number of codes that are defined for the coupon.</xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="issuingpromotionscount" type="xs:integer" use="optional">
                          <xs:annotation>
                            <xs:documentation>The number of promotions which may issue a code for the coupon (for Voucher type coupons only).</xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="redeemingpromotionscount" type="xs:integer" use="optional">
                          <xs:annotation>
                            <xs:documentation>The number of promotions which may redeem a code for the coupon.</xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="locksinuse" type="xs:boolean" use="optional">
                          <xs:annotation>
                            <xs:documentation>Flag indicating whether uses for codes of the coupon will be tracked and the code use locked until the transaction is confirmed, or the lock release time is exceeded.</xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="lockreleasetime" type="xs:integer" use="optional">
                          <xs:annotation>
                            <xs:documentation>Where locks are in use - the time in minutes that a lock for a code will be held since the most recent submission.</xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="created" type="xs:dateTime" use="optional" />
                        <xs:attribute name="createdby" type="xs:string" use="optional" />
                        <xs:attribute name="lastupdated" type="xs:dateTime" use="optional" />
                        <xs:attribute name="lastupdatedby" type="xs:string" use="optional" />
                      </xs:complexType>
                    </xs:element>
                  </xs:all>
                  <xs:attribute name="type" use="optional">
                    <xs:annotation>
                      <xs:documentation>The coupon type.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:enumeration value="SourceCode" />
                        <xs:enumeration value="Voucher" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="importexportkey" type="xs:string" use="optional">
                    <xs:annotation>
                      <xs:documentation>The allocated import/export key for the coupon.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="generateusing" use="optional">
                    <xs:annotation>
                      <xs:documentation>For Voucher type coupons only, the method used to generate new codes.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:enumeration value="NotSpecified">
                          <xs:annotation>
                            <xs:documentation>Voucher code generation type not specified, a GUID will be used</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="NewGuid">
                          <xs:annotation>
                            <xs:documentation>Voucher codes will be generated using a GUID</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="IncrementNumberSeries">
                          <xs:annotation>
                            <xs:documentation>Voucher codes will be generated using an incrementing number series</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="Mask">
                          <xs:annotation>
                            <xs:documentation>Mask</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="generateondemand" type="xs:boolean" use="optional">
                    <xs:annotation>
                      <xs:documentation>For Voucher type coupons only, a flag indicating whether codes can be automatically generated for the coupon, at the point when they are to be issued, where no unissued codes are available.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="maximumusesforgeneratedcodes" type="xs:integer" use="optional">
                    <xs:annotation>
                      <xs:documentation>For voucher type campaign/coupons, the maximum uses to be used for new codes when generating.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="issueonly" type="xs:boolean" use="optional">
                    <xs:annotation>
                      <xs:documentation>For Voucher type coupons only, a flag indicating whether codes may only be issued but never redeemed.  This configuration is typically used for integration with third party systems where those systems will redeem the codes.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="issuedcodevalidity" use="optional">
                    <xs:annotation>
                      <xs:documentation>For Voucher type coupons only, the validity period type to be used for codes at the point when they are issued.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:enumeration value="NotSpecified">
                          <xs:annotation>
                            <xs:documentation>Issued codes for this voucher do not have a validity period, they will always be valid</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="Always">
                          <xs:annotation>
                            <xs:documentation>Issued codes for this voucher will always be valid</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="FixedDateRange">
                          <xs:annotation>
                            <xs:documentation>Issued codes for this voucher will be valid between the dates specified</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="PeriodOfHours">
                          <xs:annotation>
                            <xs:documentation>Codes for this voucher will be valid for the specified number of hours from the time of issue</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="PeriodOfDays">
                          <xs:annotation>
                            <xs:documentation>Codes for this voucher will be valid for the specified number of days from the time of issue</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="PeriodOfWeeks">
                          <xs:annotation>
                            <xs:documentation>Codes for this voucher will be valid for the specified number of weeks from the time of issue</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="PeriodOfMonths">
                          <xs:annotation>
                            <xs:documentation>Codes for this voucher will be valid for the specified number of months from the time of issue</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="PeriodOfYears">
                          <xs:annotation>
                            <xs:documentation>Codes for this voucher will be valid for the specified number of years from the time of issue</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="EndOfCurrentDay">
                          <xs:annotation>
                            <xs:documentation>Codes for this voucher will be valid until the end of the day of issue</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="EndOfCurrentWeek">
                          <xs:annotation>
                            <xs:documentation>Codes for this voucher will be valid until the end of the week in which they were issued</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="EndOfCurrentMonth">
                          <xs:annotation>
                            <xs:documentation>Codes for this voucher will be valid until the end of the month in which they were issued</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="EndOfCurrentYear">
                          <xs:annotation>
                            <xs:documentation>Codes for this voucher will be valid until the end of the year in which they were issued</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="issuedcodeperiod" type="xs:integer" use="optional">
                    <xs:annotation>
                      <xs:documentation>For Voucher type coupons only, where applicable the value to be used for the period type for codes at the point when they are issued.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="issuedcodevalidfrom" type="xs:dateTime" use="optional">
                    <xs:annotation>
                      <xs:documentation>For Voucher type coupons only, where applicable the valid from date and time of codes to be assigned at the point when they are issued.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="issuedcodevalidto" type="xs:dateTime" use="optional">
                    <xs:annotation>
                      <xs:documentation>For Voucher type coupons only, where applicable the valid to date and time of codes to be assigned at the point when they are issued.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:all>
      <xs:anyAttribute processContents="skip" />
    </xs:complexType>
  </xs:element>
</xs:schema>