/*
 * Selling Partner API for Listings Restrictions
 * The Selling Partner API for Listings Restrictions provides programmatic access to restrictions on Amazon catalog listings.  For more information, see the [Listings Restrictions API Use Case Guide](doc:listings-restrictions-api-v2021-08-01-use-case-guide).
 *
 * OpenAPI spec version: 2021-08-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 { Reason } from "./Reason.js";

/**
 * The Restriction model module.
 * @module listingsRestrictions_2021-08-01/js-client.listingsRestrictions_2021-08-01.model/Restriction
 * @version 2021-08-01
 */
export class Restriction {
  /**
   * Constructs a new <code>Restriction</code>.
   * A listing restriction, optionally qualified by a condition, with a list of reasons for the restriction.
   * @alias module:listingsRestrictions_2021-08-01/js-client.listingsRestrictions_2021-08-01.model/Restriction
   * @class
   * @param marketplaceId {String} A marketplace identifier. Identifies the Amazon marketplace where the restriction is enforced.
   */
  constructor(marketplaceId) {
    this.marketplaceId = marketplaceId;
  }

  /**
   * Constructs a <code>Restriction</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:listingsRestrictions_2021-08-01/js-client.listingsRestrictions_2021-08-01.model/Restriction} obj Optional instance to populate.
   * @return {module:listingsRestrictions_2021-08-01/js-client.listingsRestrictions_2021-08-01.model/Restriction} The populated <code>Restriction</code> instance.
   */
  static constructFromObject(data, obj) {
    if (data) {
      obj = obj || new Restriction();
      if (data.hasOwnProperty("marketplaceId"))
        obj.marketplaceId = ApiClient.convertToType(
          data["marketplaceId"],
          "String",
        );
      if (data.hasOwnProperty("conditionType"))
        obj.conditionType = ApiClient.convertToType(
          data["conditionType"],
          "String",
        );
      if (data.hasOwnProperty("reasons"))
        obj.reasons = ApiClient.convertToType(data["reasons"], [Reason]);
    }
    return obj;
  }
}

/**
 * A marketplace identifier. Identifies the Amazon marketplace where the restriction is enforced.
 * @member {String} marketplaceId
 */
Restriction.prototype.marketplaceId = undefined;

/**
 * Allowed values for the <code>conditionType</code> property.
 * @enum {String}
 * @readonly
 */
Restriction.ConditionTypeEnum = {
  /**
   * value: "new_new"
   * @const
   */
  newNew: "new_new",

  /**
   * value: "new_open_box"
   * @const
   */
  newOpenBox: "new_open_box",

  /**
   * value: "new_oem"
   * @const
   */
  newOem: "new_oem",

  /**
   * value: "refurbished_refurbished"
   * @const
   */
  refurbishedRefurbished: "refurbished_refurbished",

  /**
   * value: "used_like_new"
   * @const
   */
  usedLikeNew: "used_like_new",

  /**
   * value: "used_very_good"
   * @const
   */
  usedVeryGood: "used_very_good",

  /**
   * value: "used_good"
   * @const
   */
  usedGood: "used_good",

  /**
   * value: "used_acceptable"
   * @const
   */
  usedAcceptable: "used_acceptable",

  /**
   * value: "collectible_like_new"
   * @const
   */
  collectibleLikeNew: "collectible_like_new",

  /**
   * value: "collectible_very_good"
   * @const
   */
  collectibleVeryGood: "collectible_very_good",

  /**
   * value: "collectible_good"
   * @const
   */
  collectibleGood: "collectible_good",

  /**
   * value: "collectible_acceptable"
   * @const
   */
  collectibleAcceptable: "collectible_acceptable",

  /**
   * value: "club_club"
   * @const
   */
  clubClub: "club_club",
};

/**
 * The condition that applies to the restriction.
 * @member {module:listingsRestrictions_2021-08-01/js-client.listingsRestrictions_2021-08-01.model/Restriction.ConditionTypeEnum} conditionType
 */
Restriction.prototype.conditionType = undefined;

/**
 * A list of reasons for the restriction.
 * @member {Array.<module:listingsRestrictions_2021-08-01/js-client.listingsRestrictions_2021-08-01.model/Reason>} reasons
 */
Restriction.prototype.reasons = undefined;
