Source: models/DiscountRequest.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 DiscountRequest model module.
* @module models/DiscountRequest
* @version 20.4
*/
export default class DiscountRequest {
    /**
    * Constructs a new <code>DiscountRequest</code>.
    * Document representing a discount to be applied to a custom price adjustment. The properties
    * @alias module:models/DiscountRequest
    * @class
    * @param type {module:models/DiscountRequest.TypeEnum} The type of discount.
    * @param value {Number} The amount of the discount.
    */

    constructor(type, value) {





        this.type = type; this.value = value


    }

    /**
    * Constructs a <code>DiscountRequest</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/DiscountRequest} obj Optional instance to populate.
    * @return {module:models/DiscountRequest} The populated <code>DiscountRequest</code> instance.
    */
    static constructFromObject(data, obj) {
        if (data) {
            obj = obj || new DiscountRequest()





            if (data.hasOwnProperty('type')) {
                obj.type = ApiClient.convertToType(data.type, 'String')
            }
            if (data.hasOwnProperty('value')) {
                obj.value = ApiClient.convertToType(data.value, 'Number')
            }
        }
        return obj
    }

    /**
    * The type of discount.
    * @member {module:models/DiscountRequest.TypeEnum} type
    */
    type = undefined;
    /**
    * The amount of the discount.
    * @member {Number} value
    */
    value = undefined;






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

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

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

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



}