1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * 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
 */

/// Restriction : A listing restriction, optionally qualified by a condition, with a list of reasons for the restriction.



#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct Restriction {
    /// A marketplace identifier. Identifies the Amazon marketplace where the restriction is enforced.
    #[serde(default, rename = "marketplaceId")]
    pub marketplace_id: String,
    /// The condition that applies to the restriction.
    #[serde(default, rename = "conditionType", skip_serializing_if = "Option::is_none")]
    pub condition_type: Option<ConditionType>,
    /// A list of reasons for the restriction.
    #[serde(default, rename = "reasons", skip_serializing_if = "Option::is_none")]
    pub reasons: Option<Vec<crate::models::Reason>>,
}

impl Restriction {
    /// A listing restriction, optionally qualified by a condition, with a list of reasons for the restriction.
    pub fn new(marketplace_id: String) -> Restriction {
        Restriction {
            marketplace_id,
            condition_type: None,
            reasons: None,
        }
    }
}

/// The condition that applies to the restriction.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ConditionType {
    #[serde(rename = "new_new")]
    NewNew,
    #[serde(rename = "new_open_box")]
    NewOpenBox,
    #[serde(rename = "new_oem")]
    NewOem,
    #[serde(rename = "refurbished_refurbished")]
    RefurbishedRefurbished,
    #[serde(rename = "used_like_new")]
    UsedLikeNew,
    #[serde(rename = "used_very_good")]
    UsedVeryGood,
    #[serde(rename = "used_good")]
    UsedGood,
    #[serde(rename = "used_acceptable")]
    UsedAcceptable,
    #[serde(rename = "collectible_like_new")]
    CollectibleLikeNew,
    #[serde(rename = "collectible_very_good")]
    CollectibleVeryGood,
    #[serde(rename = "collectible_good")]
    CollectibleGood,
    #[serde(rename = "collectible_acceptable")]
    CollectibleAcceptable,
    #[serde(rename = "club_club")]
    ClubClub,
}

impl Default for ConditionType {
    fn default() -> ConditionType {
        Self::NewNew
    }
}