1use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Subscription {
17 #[serde(rename = "id")]
19 pub id: String,
20 #[serde(rename = "createdAt")]
22 pub created_at: String,
23 #[serde(rename = "updatedAt")]
25 pub updated_at: String,
26 #[serde(rename = "type")]
28 pub r#type: Type,
29 #[serde(rename = "status")]
31 pub status: Status,
32 #[serde(rename = "credits")]
34 pub credits: String,
35 #[serde(rename = "concurrencyCounter")]
37 pub concurrency_counter: f64,
38 #[serde(rename = "concurrencyLimitIncluded")]
40 pub concurrency_limit_included: f64,
41 #[serde(
43 rename = "phoneNumbersCounter",
44 skip_serializing_if = "Option::is_none"
45 )]
46 pub phone_numbers_counter: Option<f64>,
47 #[serde(
49 rename = "phoneNumbersIncluded",
50 skip_serializing_if = "Option::is_none"
51 )]
52 pub phone_numbers_included: Option<f64>,
53 #[serde(rename = "concurrencyLimitPurchased")]
55 pub concurrency_limit_purchased: f64,
56 #[serde(
58 rename = "monthlyChargeScheduleId",
59 skip_serializing_if = "Option::is_none"
60 )]
61 pub monthly_charge_schedule_id: Option<f64>,
62 #[serde(
64 rename = "monthlyCreditCheckScheduleId",
65 skip_serializing_if = "Option::is_none"
66 )]
67 pub monthly_credit_check_schedule_id: Option<f64>,
68 #[serde(rename = "stripeCustomerId", skip_serializing_if = "Option::is_none")]
70 pub stripe_customer_id: Option<String>,
71 #[serde(
73 rename = "stripePaymentMethodId",
74 skip_serializing_if = "Option::is_none"
75 )]
76 pub stripe_payment_method_id: Option<String>,
77 #[serde(
79 rename = "slackSupportEnabled",
80 skip_serializing_if = "Option::is_none"
81 )]
82 pub slack_support_enabled: Option<bool>,
83 #[serde(rename = "slackChannelId", skip_serializing_if = "Option::is_none")]
85 pub slack_channel_id: Option<String>,
86 #[serde(rename = "hipaaEnabled", skip_serializing_if = "Option::is_none")]
88 pub hipaa_enabled: Option<bool>,
89 #[serde(
91 rename = "hipaaCommonPaperAgreementId",
92 skip_serializing_if = "Option::is_none"
93 )]
94 pub hipaa_common_paper_agreement_id: Option<String>,
95 #[serde(
97 rename = "stripePaymentMethodFingerprint",
98 skip_serializing_if = "Option::is_none"
99 )]
100 pub stripe_payment_method_fingerprint: Option<String>,
101 #[serde(
103 rename = "stripeCustomerEmail",
104 skip_serializing_if = "Option::is_none"
105 )]
106 pub stripe_customer_email: Option<String>,
107 #[serde(rename = "referredByEmail", skip_serializing_if = "Option::is_none")]
109 pub referred_by_email: Option<String>,
110 #[serde(rename = "autoReloadPlan", skip_serializing_if = "Option::is_none")]
112 pub auto_reload_plan: Option<models::AutoReloadPlan>,
113 #[serde(rename = "minutesIncluded", skip_serializing_if = "Option::is_none")]
115 pub minutes_included: Option<f64>,
116 #[serde(rename = "minutesUsed", skip_serializing_if = "Option::is_none")]
118 pub minutes_used: Option<f64>,
119 #[serde(
121 rename = "minutesUsedNextResetAt",
122 skip_serializing_if = "Option::is_none"
123 )]
124 pub minutes_used_next_reset_at: Option<String>,
125 #[serde(rename = "minutesOverageCost", skip_serializing_if = "Option::is_none")]
127 pub minutes_overage_cost: Option<f64>,
128 #[serde(rename = "providersIncluded", skip_serializing_if = "Option::is_none")]
130 pub providers_included: Option<Vec<String>>,
131 #[serde(
133 rename = "outboundCallsDailyLimit",
134 skip_serializing_if = "Option::is_none"
135 )]
136 pub outbound_calls_daily_limit: Option<f64>,
137 #[serde(
139 rename = "outboundCallsCounter",
140 skip_serializing_if = "Option::is_none"
141 )]
142 pub outbound_calls_counter: Option<f64>,
143 #[serde(
145 rename = "outboundCallsCounterNextResetAt",
146 skip_serializing_if = "Option::is_none"
147 )]
148 pub outbound_calls_counter_next_reset_at: Option<String>,
149 #[serde(rename = "couponIds", skip_serializing_if = "Option::is_none")]
151 pub coupon_ids: Option<Vec<String>>,
152 #[serde(rename = "couponUsageLeft", skip_serializing_if = "Option::is_none")]
154 pub coupon_usage_left: Option<String>,
155 #[serde(rename = "invoicePlan", skip_serializing_if = "Option::is_none")]
157 pub invoice_plan: Option<models::InvoicePlan>,
158}
159
160impl Subscription {
161 pub fn new(
162 id: String,
163 created_at: String,
164 updated_at: String,
165 r#type: Type,
166 status: Status,
167 credits: String,
168 concurrency_counter: f64,
169 concurrency_limit_included: f64,
170 concurrency_limit_purchased: f64,
171 ) -> Subscription {
172 Subscription {
173 id,
174 created_at,
175 updated_at,
176 r#type,
177 status,
178 credits,
179 concurrency_counter,
180 concurrency_limit_included,
181 phone_numbers_counter: None,
182 phone_numbers_included: None,
183 concurrency_limit_purchased,
184 monthly_charge_schedule_id: None,
185 monthly_credit_check_schedule_id: None,
186 stripe_customer_id: None,
187 stripe_payment_method_id: None,
188 slack_support_enabled: None,
189 slack_channel_id: None,
190 hipaa_enabled: None,
191 hipaa_common_paper_agreement_id: None,
192 stripe_payment_method_fingerprint: None,
193 stripe_customer_email: None,
194 referred_by_email: None,
195 auto_reload_plan: None,
196 minutes_included: None,
197 minutes_used: None,
198 minutes_used_next_reset_at: None,
199 minutes_overage_cost: None,
200 providers_included: None,
201 outbound_calls_daily_limit: None,
202 outbound_calls_counter: None,
203 outbound_calls_counter_next_reset_at: None,
204 coupon_ids: None,
205 coupon_usage_left: None,
206 invoice_plan: None,
207 }
208 }
209}
210#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
212pub enum Type {
213 #[serde(rename = "trial")]
214 Trial,
215 #[serde(rename = "pay-as-you-go")]
216 PayAsYouGo,
217 #[serde(rename = "enterprise")]
218 Enterprise,
219}
220
221impl Default for Type {
222 fn default() -> Type {
223 Self::Trial
224 }
225}
226#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
228pub enum Status {
229 #[serde(rename = "active")]
230 Active,
231 #[serde(rename = "frozen")]
232 Frozen,
233}
234
235impl Default for Status {
236 fn default() -> Status {
237 Self::Active
238 }
239}