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
// ======================================
// This file was automatically generated.
// ======================================

use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "SubscriptionsTrialsResourceTrialSettings".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionsTrialsResourceTrialSettings {
    pub end_behavior: SubscriptionsTrialsResourceEndBehavior,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SubscriptionsTrialsResourceEndBehavior {
    /// Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
    pub missing_payment_method: SubscriptionsTrialsResourceEndBehaviorMissingPaymentMethod,
}

/// An enum representing the possible values of an `SubscriptionsTrialsResourceEndBehavior`'s `missing_payment_method` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SubscriptionsTrialsResourceEndBehaviorMissingPaymentMethod {
    Cancel,
    CreateInvoice,
    Pause,
}

impl SubscriptionsTrialsResourceEndBehaviorMissingPaymentMethod {
    pub fn as_str(self) -> &'static str {
        match self {
            SubscriptionsTrialsResourceEndBehaviorMissingPaymentMethod::Cancel => "cancel",
            SubscriptionsTrialsResourceEndBehaviorMissingPaymentMethod::CreateInvoice => {
                "create_invoice"
            }
            SubscriptionsTrialsResourceEndBehaviorMissingPaymentMethod::Pause => "pause",
        }
    }
}

impl AsRef<str> for SubscriptionsTrialsResourceEndBehaviorMissingPaymentMethod {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for SubscriptionsTrialsResourceEndBehaviorMissingPaymentMethod {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for SubscriptionsTrialsResourceEndBehaviorMissingPaymentMethod {
    fn default() -> Self {
        Self::Cancel
    }
}