/*
 * Selling Partner API for Catalog Items
 * The Selling Partner API for Catalog Items provides programmatic access to information about items in the Amazon catalog.  For more information, refer to the [Catalog Items API Use Case Guide](doc:catalog-items-api-v2022-04-01-use-case-guide).
 *
 * OpenAPI spec version: 2022-04-01
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 *
 * Swagger Codegen version: 2.4.9
 *
 * Do not edit the class manually.
 *
 */

import { ApiClient } from "../ApiClient.js";
import { ItemVariationTheme } from "./ItemVariationTheme.js";

/**
 * The ItemRelationship model module.
 * @module catalogItems_2022-04-01/js-client.catalogItems_2022-04-01.model/ItemRelationship
 * @version 2022-04-01
 */
export class ItemRelationship {
  /**
   * Constructs a new <code>ItemRelationship</code>.
   * Relationship details for an Amazon catalog item.
   * @alias module:catalogItems_2022-04-01/js-client.catalogItems_2022-04-01.model/ItemRelationship
   * @class
   * @param type {module:catalogItems_2022-04-01/js-client.catalogItems_2022-04-01.model/ItemRelationship.TypeEnum} Type of relationship.
   */
  constructor(type) {
    this.type = type;
  }

  /**
   * Constructs a <code>ItemRelationship</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:catalogItems_2022-04-01/js-client.catalogItems_2022-04-01.model/ItemRelationship} obj Optional instance to populate.
   * @return {module:catalogItems_2022-04-01/js-client.catalogItems_2022-04-01.model/ItemRelationship} The populated <code>ItemRelationship</code> instance.
   */
  static constructFromObject(data, obj) {
    if (data) {
      obj = obj || new ItemRelationship();
      if (data.hasOwnProperty("childAsins"))
        obj.childAsins = ApiClient.convertToType(data["childAsins"], [
          "String",
        ]);
      if (data.hasOwnProperty("parentAsins"))
        obj.parentAsins = ApiClient.convertToType(data["parentAsins"], [
          "String",
        ]);
      if (data.hasOwnProperty("variationTheme"))
        obj.variationTheme = ItemVariationTheme.constructFromObject(
          data["variationTheme"],
        );
      if (data.hasOwnProperty("type"))
        obj.type = ApiClient.convertToType(data["type"], "String");
    }
    return obj;
  }
}

/**
 * Identifiers (ASINs) of the related items that are children of this item.
 * @member {Array.<String>} childAsins
 */
ItemRelationship.prototype.childAsins = undefined;

/**
 * Identifiers (ASINs) of the related items that are parents of this item.
 * @member {Array.<String>} parentAsins
 */
ItemRelationship.prototype.parentAsins = undefined;

/**
 * For \"VARIATION\" relationships, variation theme indicating the combination of Amazon item catalog attributes that define the variation family.
 * @member {module:catalogItems_2022-04-01/js-client.catalogItems_2022-04-01.model/ItemVariationTheme} variationTheme
 */
ItemRelationship.prototype.variationTheme = undefined;

/**
 * Allowed values for the <code>type</code> property.
 * @enum {String}
 * @readonly
 */
ItemRelationship.TypeEnum = {
  /**
   * value: "VARIATION"
   * @const
   */
  VARIATION: "VARIATION",

  /**
   * value: "PACKAGE_HIERARCHY"
   * @const
   */
  PACKAGE_HIERARCHY: "PACKAGE_HIERARCHY",
};

/**
 * Type of relationship.
 * @member {module:catalogItems_2022-04-01/js-client.catalogItems_2022-04-01.model/ItemRelationship.TypeEnum} type
 */
ItemRelationship.prototype.type = undefined;
