Source: models/CouponItem.js

/* * *  *  * *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
/* Copyright (c) 2020 Mobify Research & Development Inc. All rights reserved. */
/* * *  *  * *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */

/**
 * Shop API
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: 20.4
 *
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 *
 */


import ApiClient from '../ApiClient'





/**
* The CouponItem model module.
* @module models/CouponItem
* @version 20.4
*/
export default class CouponItem {
    /**
    * Constructs a new <code>CouponItem</code>.
    * Document representing a coupon item.
    * @alias module:models/CouponItem
    * @class
    * @param code {String} The coupon code.
    */

    constructor(code) {





        this.code = code


    }

    /**
    * Constructs a <code>CouponItem</code> from a plain JavaScript object, optionally creating a new instance.
    * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
    * @param {Object} data The plain JavaScript object bearing properties of interest.
    * @param {module:models/CouponItem} obj Optional instance to populate.
    * @return {module:models/CouponItem} The populated <code>CouponItem</code> instance.
    */
    static constructFromObject(data, obj) {
        if (data) {
            obj = obj || new CouponItem()





            if (data.hasOwnProperty('code')) {
                obj.code = ApiClient.convertToType(data.code, 'String')
            }
            if (data.hasOwnProperty('coupon_item_id')) {
                obj.coupon_item_id = ApiClient.convertToType(data.coupon_item_id, 'String')
            }
            if (data.hasOwnProperty('status_code')) {
                obj.status_code = ApiClient.convertToType(data.status_code, 'String')
            }
            if (data.hasOwnProperty('valid')) {
                obj.valid = ApiClient.convertToType(data.valid, 'Boolean')
            }
        }
        return obj
    }

    /**
    * The coupon code.
    * @member {String} code
    */
    code = undefined;
    /**
    * The coupon item id.
    * @member {String} coupon_item_id
    */
    coupon_item_id = undefined;
    /**
    * The status of the coupon item.
    * @member {module:models/CouponItem.StatusCodeEnum} status_code
    */
    status_code = undefined;
    /**
    * A flag indicating whether the coupon item is valid. A coupon line item is valid if  the status code is 'applied' or 'no_applicable_promotion'.
    * @member {Boolean} valid
    */
    valid = undefined;






    /**
    * Allowed values for the <code>status_code</code> property.
    * @enum {String}
    * @readonly
    */
    static StatusCodeEnum = {

        /**
         * value: "coupon_code_already_in_basket"
         * @const
         */
        coupon_code_already_in_basket: 'coupon_code_already_in_basket',

        /**
         * value: "coupon_code_already_redeemed"
         * @const
         */
        coupon_code_already_redeemed: 'coupon_code_already_redeemed',

        /**
         * value: "coupon_code_unknown"
         * @const
         */
        coupon_code_unknown: 'coupon_code_unknown',

        /**
         * value: "coupon_disabled"
         * @const
         */
        coupon_disabled: 'coupon_disabled',

        /**
         * value: "redemption_limit_exceeded"
         * @const
         */
        redemption_limit_exceeded: 'redemption_limit_exceeded',

        /**
         * value: "customer_redemption_limit_exceeded"
         * @const
         */
        customer_redemption_limit_exceeded: 'customer_redemption_limit_exceeded',

        /**
         * value: "timeframe_redemption_limit_exceeded"
         * @const
         */
        timeframe_redemption_limit_exceeded: 'timeframe_redemption_limit_exceeded',

        /**
         * value: "no_active_promotion"
         * @const
         */
        no_active_promotion: 'no_active_promotion',

        /**
         * value: "coupon_already_in_basket"
         * @const
         */
        coupon_already_in_basket: 'coupon_already_in_basket',

        /**
         * value: "no_applicable_promotion"
         * @const
         */
        no_applicable_promotion: 'no_applicable_promotion',

        /**
         * value: "applied"
         * @const
         */
        applied: 'applied',

        /**
         * value: "adhoc"
         * @const
         */
        adhoc: 'adhoc'
    };



}