/*
 * 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 { Link } from "./Link.js";

/**
 * The Reason model module.
 * @module listingsRestrictions_2021-08-01/js-client.listingsRestrictions_2021-08-01.model/Reason
 * @version 2021-08-01
 */
export class Reason {
  /**
   * Constructs a new <code>Reason</code>.
   * A reason for the restriction, including path forward links that may allow Selling Partners to remove the restriction, if available.
   * @alias module:listingsRestrictions_2021-08-01/js-client.listingsRestrictions_2021-08-01.model/Reason
   * @class
   * @param message {String} A message describing the reason for the restriction.
   */
  constructor(message) {
    this.message = message;
  }

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

/**
 * A message describing the reason for the restriction.
 * @member {String} message
 */
Reason.prototype.message = undefined;

/**
 * Allowed values for the <code>reasonCode</code> property.
 * @enum {String}
 * @readonly
 */
Reason.ReasonCodeEnum = {
  /**
   * value: "APPROVAL_REQUIRED"
   * @const
   */
  APPROVAL_REQUIRED: "APPROVAL_REQUIRED",

  /**
   * value: "ASIN_NOT_FOUND"
   * @const
   */
  ASIN_NOT_FOUND: "ASIN_NOT_FOUND",

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

/**
 * A code indicating why the listing is restricted.
 * @member {module:listingsRestrictions_2021-08-01/js-client.listingsRestrictions_2021-08-01.model/Reason.ReasonCodeEnum} reasonCode
 */
Reason.prototype.reasonCode = undefined;

/**
 * A list of path forward links that may allow Selling Partners to remove the restriction.
 * @member {Array.<module:listingsRestrictions_2021-08-01/js-client.listingsRestrictions_2021-08-01.model/Link>} links
 */
Reason.prototype.links = undefined;
