Source: models/Voucher.js

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

/**
 * OCC No description provided (generated by Swagger Codegen
 * https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: v2
 *
 *
 * 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'
import CurrencyOCC from './CurrencyOCC'
import Price from './Price'

/**
* The Voucher model module.
* @module models/Voucher
* @version v2
*/
export default class Voucher {
    /**
    * Constructs a new <code>Voucher</code>.
    * @alias module:models/Voucher
    * @class
    */

    constructor() {
        /**
    *
    * @member {String} code
    */
        this.code = undefined
        /**
    *
    * @member {String} voucherCode
    */
        this.voucherCode = undefined
        /**
    *
    * @member {String} name
    */
        this.name = undefined
        /**
    *
    * @member {String} description
    */
        this.description = undefined
        /**
    *
    * @member {Number} value
    */
        this.value = undefined
        /**
    *
    * @member {String} valueFormatted
    */
        this.valueFormatted = undefined
        /**
    *
    * @member {String} valueString
    */
        this.valueString = undefined
        /**
    *
    * @member {Boolean} freeShipping
    */
        this.freeShipping = undefined
        /**
    * @member {module:models/CurrencyOCC} currency
    */
        this.currency = undefined
        /**
    * @member {module:models/Price} appliedValue
    */
        this.appliedValue = undefined
    }

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

            if (data.hasOwnProperty('code')) {
                obj.code = ApiClient.convertToType(data.code, 'String')
            }
            if (data.hasOwnProperty('voucherCode')) {
                obj.voucherCode = ApiClient.convertToType(data.voucherCode, 'String')
            }
            if (data.hasOwnProperty('name')) {
                obj.name = ApiClient.convertToType(data.name, 'String')
            }
            if (data.hasOwnProperty('description')) {
                obj.description = ApiClient.convertToType(data.description, 'String')
            }
            if (data.hasOwnProperty('value')) {
                obj.value = ApiClient.convertToType(data.value, 'Number')
            }
            if (data.hasOwnProperty('valueFormatted')) {
                obj.valueFormatted = ApiClient.convertToType(data.valueFormatted, 'String')
            }
            if (data.hasOwnProperty('valueString')) {
                obj.valueString = ApiClient.convertToType(data.valueString, 'String')
            }
            if (data.hasOwnProperty('freeShipping')) {
                obj.freeShipping = ApiClient.convertToType(data.freeShipping, 'Boolean')
            }
            if (data.hasOwnProperty('currency')) {
                obj.currency = CurrencyOCC.constructFromObject(data.currency)
            }
            if (data.hasOwnProperty('appliedValue')) {
                obj.appliedValue = Price.constructFromObject(data.appliedValue)
            }
        }
        return obj
    }



}