/* * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* 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'
import Image from './Image'
import ProductRef from './ProductRef'
import ProductType from './ProductType'
import VariationAttribute from './VariationAttribute'
/**
* The ProductSearchHit model module.
* @module models/ProductSearchHit
* @version 20.4
*/
export default class ProductSearchHit {
/**
* Constructs a new <code>ProductSearchHit</code>.
* Document representing a product search hit.
* @alias module:models/ProductSearchHit
* @class
*/
constructor() {
}
/**
* Constructs a <code>ProductSearchHit</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/ProductSearchHit} obj Optional instance to populate.
* @return {module:models/ProductSearchHit} The populated <code>ProductSearchHit</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new ProductSearchHit()
if (data.hasOwnProperty('currency')) {
obj.currency = ApiClient.convertToType(data.currency, 'String')
}
if (data.hasOwnProperty('hit_type')) {
obj.hit_type = ApiClient.convertToType(data.hit_type, 'String')
}
if (data.hasOwnProperty('image')) {
obj.image = Image.constructFromObject(data.image)
}
if (data.hasOwnProperty('link')) {
obj.link = ApiClient.convertToType(data.link, 'String')
}
if (data.hasOwnProperty('orderable')) {
obj.orderable = ApiClient.convertToType(data.orderable, 'Boolean')
}
if (data.hasOwnProperty('price')) {
obj.price = ApiClient.convertToType(data.price, 'Number')
}
if (data.hasOwnProperty('price_max')) {
obj.price_max = ApiClient.convertToType(data.price_max, 'Number')
}
if (data.hasOwnProperty('prices')) {
obj.prices = ApiClient.convertToType(data.prices, {String: 'Number'})
}
if (data.hasOwnProperty('product_id')) {
obj.product_id = ApiClient.convertToType(data.product_id, 'String')
}
if (data.hasOwnProperty('product_name')) {
obj.product_name = ApiClient.convertToType(data.product_name, 'String')
}
if (data.hasOwnProperty('product_type')) {
obj.product_type = ProductType.constructFromObject(data.product_type)
}
if (data.hasOwnProperty('represented_product')) {
obj.represented_product = ProductRef.constructFromObject(data.represented_product)
}
if (data.hasOwnProperty('represented_products')) {
obj.represented_products = ApiClient.convertToType(data.represented_products, [ProductRef])
}
if (data.hasOwnProperty('variation_attributes')) {
obj.variation_attributes = ApiClient.convertToType(data.variation_attributes, [VariationAttribute])
}
}
return obj
}
/**
* The ISO 4217 mnemonic code of the currency.
* @member {String} currency
*/
currency = undefined;
/**
* The type information for the search hit.
* @member {String} hit_type
*/
hit_type = undefined;
/**
* The first image of the product hit for the configured viewtype.
* @member {module:models/Image} image
*/
image = undefined;
/**
* The URL addressing the product.
* @member {String} link
*/
link = undefined;
/**
* A flag indicating whether the product is orderable.
* @member {Boolean} orderable
*/
orderable = undefined;
/**
* The sales price of the product. In case of complex products like master or set this is the minimum price of related child products.
* @member {Number} price
*/
price = undefined;
/**
* The maximum sales of related child products in case of complex products like master or set.
* @member {Number} price_max
*/
price_max = undefined;
/**
* The prices map with price book ids and their values.
* @member {Object.<String, Number>} prices
*/
prices = undefined;
/**
* The id (SKU) of the product.
* @member {String} product_id
*/
product_id = undefined;
/**
* The localized name of the product.
* @member {String} product_name
*/
product_name = undefined;
/**
* The type information for the product.
* @member {module:models/ProductType} product_type
*/
product_type = undefined;
/**
* The first represented product.
* @member {module:models/ProductRef} represented_product
*/
represented_product = undefined;
/**
* All the represented products.
* @member {Array.<module:models/ProductRef>} represented_products
*/
represented_products = undefined;
/**
* The array of represented variation attributes (for the master product only). This array can be empty.
* @member {Array.<module:models/VariationAttribute>} variation_attributes
*/
variation_attributes = undefined;
}