amazon-spapi 2.0.3

A Rust client library for Amazon Selling Partner API (SP-API)
Documentation
/*
 * 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).
 *
 * The version of the OpenAPI document: 2021-08-01
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// Reason : A reason for the restriction, including path forward links that may allow Selling Partners to remove the restriction, if available.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Reason {
    /// A message describing the reason for the restriction.
    #[serde(rename = "message")]
    pub message: String,
    /// A code indicating why the listing is restricted.
    #[serde(rename = "reasonCode", skip_serializing_if = "Option::is_none")]
    pub reason_code: Option<ReasonCode>,
    /// A list of path forward links that may allow Selling Partners to remove the restriction.
    #[serde(rename = "links", skip_serializing_if = "Option::is_none")]
    pub links: Option<Vec<models::listings_restrictions_2021_08_01::Link>>,
}

impl Reason {
    /// A reason for the restriction, including path forward links that may allow Selling Partners to remove the restriction, if available.
    pub fn new(message: String) -> Reason {
        Reason {
            message,
            reason_code: None,
            links: None,
        }
    }
}
/// A code indicating why the listing is restricted.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ReasonCode {
    #[serde(rename = "APPROVAL_REQUIRED")]
    ApprovalRequired,
    #[serde(rename = "ASIN_NOT_FOUND")]
    AsinNotFound,
    #[serde(rename = "NOT_ELIGIBLE")]
    NotEligible,
}

impl Default for ReasonCode {
    fn default() -> ReasonCode {
        Self::ApprovalRequired
    }
}