<?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: Coupon Code Import Schema</xs:documentation>
    <xs:documentation>The coupon code import allows multiple codes (for Third Party type coupons only) to be imported. </xs:documentation>
    <xs:documentation> Against each code, a valid from/to date, maximum uses and status can be optionally provided.</xs:documentation>
    <xs:documentation> To delete an existing code, the deleted attribute should be provided with a value of 'true'.</xs:documentation>
    <xs:documentation>Version 1.0 : 2015-06-10.  Initial schema creation, after enhanced coupon functionality introduced. </xs:documentation>
    <xs:documentation> Version 1.1 : 2017-01-09.  Updates to include max field lengths and descriptions. </xs:documentation>
    <xs:documentation> Version 1.2 : 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="items">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="0" maxOccurs="10000" name="item">
                <xs:complexType>
                  <xs:attribute name="couponkey" use="optional">
                    <xs:annotation>
                      <xs:documentation>The unique coupon key assigned to the coupon for which codes will be imported. If this key is not present then the key against the code will be used. If there is no key against the code either then a coupon NAME must be speficied against the code and a new third-party coupon with this name will be created. The key is created automatically by Promo when creating your coupon.  To view the key navigate to the Coupon in the Promo Administration Portal.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="100" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="couponname" use="optional">
                    <xs:annotation>
                      <xs:documentation>A name to use ONLY when creating a new third-party coupon via this import. This will be used if the coupon key is not supplied. Note that if a coupon key IS supplied but does not match then an error will be returned.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="1000" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="deleted" type="xs:boolean" use="optional" />
                  <xs:attribute name="code" type="xs:string" use="optional">
                    <xs:annotation>
                      <xs:documentation>The coupon code to be added, updated or deleted.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="status" use="optional">
                    <xs:annotation>
                      <xs:documentation>The status to set the coupon code to.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:enumeration value="ACTIVE">
                          <xs:annotation>
                            <xs:documentation>The code (for a source code) is ACTIVE</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="CREATED">
                          <xs:annotation>
                            <xs:documentation>The code (for a Voucher) has been CREATED</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="ISSUED">
                          <xs:annotation>
                            <xs:documentation>The code (for a Voucher) has been ISSUED</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="REDEEMED">
                          <xs:annotation>
                            <xs:documentation>The code has been fully utilized and is REDEEMED</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="EXPIRED">
                          <xs:annotation>
                            <xs:documentation>The code has EXPIRED</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="WITHDRAWN">
                          <xs:annotation>
                            <xs:documentation>The code has been WITHDRAWN</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="RESERVED">
                          <xs:annotation>
                            <xs:documentation>The code has been RESERVED</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="validfrom" use="optional">
                    <xs:annotation>
                      <xs:documentation>A date and time indicating when the coupon code is valid from.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:dateTime">
                        <xs:minInclusive value="2000-01-01T00:00:01" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="validto" use="optional">
                    <xs:annotation>
                      <xs:documentation>A date and time indicating when the coupon code is valid until.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:dateTime">
                        <xs:minInclusive value="2000-01-01T00:00:01" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="maximumuses" type="xs:integer" use="optional">
                    <xs:annotation>
                      <xs:documentation>The maximum number of times the coupon code may be utilized by unique baskets.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:all>
      <xs:attribute name="couponkey" use="optional">
        <xs:annotation>
          <xs:documentation>The unique coupon key assigned to the coupon for which codes will be imported. If this key is not present then the key against the code will be used. If there is no key against the code either then a coupon NAME must be speficied against the code and a new third-party coupon with this name will be created. The key is created automatically by Promo when creating your coupon.  To view the key navigate to the Coupon in the Promo Administration Portal.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="100" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <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>