1use serde::{Deserialize, Serialize};
12use utoipa::ToSchema;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, ToSchema)]
18pub struct Subscription {
19 #[serde(rename = "id")]
21 pub id: String,
22 #[serde(rename = "createdAt")]
24 pub created_at: String,
25 #[serde(rename = "updatedAt")]
27 pub updated_at: String,
28 #[serde(rename = "type")]
30 pub r#type: Type,
31 #[serde(rename = "status")]
33 pub status: Status,
34 #[serde(rename = "credits")]
36 pub credits: String,
37 #[serde(rename = "concurrencyCounter")]
39 pub concurrency_counter: f64,
40 #[serde(rename = "concurrencyLimitIncluded")]
42 pub concurrency_limit_included: f64,
43 #[serde(
45 rename = "phoneNumbersCounter",
46 skip_serializing_if = "Option::is_none"
47 )]
48 pub phone_numbers_counter: Option<f64>,
49 #[serde(
51 rename = "phoneNumbersIncluded",
52 skip_serializing_if = "Option::is_none"
53 )]
54 pub phone_numbers_included: Option<f64>,
55 #[serde(rename = "concurrencyLimitPurchased")]
57 pub concurrency_limit_purchased: f64,
58 #[serde(
60 rename = "monthlyChargeScheduleId",
61 skip_serializing_if = "Option::is_none"
62 )]
63 pub monthly_charge_schedule_id: Option<f64>,
64 #[serde(
66 rename = "monthlyCreditCheckScheduleId",
67 skip_serializing_if = "Option::is_none"
68 )]
69 pub monthly_credit_check_schedule_id: Option<f64>,
70 #[serde(rename = "stripeCustomerId", skip_serializing_if = "Option::is_none")]
72 pub stripe_customer_id: Option<String>,
73 #[serde(
75 rename = "stripePaymentMethodId",
76 skip_serializing_if = "Option::is_none"
77 )]
78 pub stripe_payment_method_id: Option<String>,
79 #[serde(
81 rename = "slackSupportEnabled",
82 skip_serializing_if = "Option::is_none"
83 )]
84 pub slack_support_enabled: Option<bool>,
85 #[serde(rename = "slackChannelId", skip_serializing_if = "Option::is_none")]
87 pub slack_channel_id: Option<String>,
88 #[serde(rename = "hipaaEnabled", skip_serializing_if = "Option::is_none")]
90 pub hipaa_enabled: Option<bool>,
91 #[serde(
93 rename = "hipaaCommonPaperAgreementId",
94 skip_serializing_if = "Option::is_none"
95 )]
96 pub hipaa_common_paper_agreement_id: Option<String>,
97 #[serde(
99 rename = "stripePaymentMethodFingerprint",
100 skip_serializing_if = "Option::is_none"
101 )]
102 pub stripe_payment_method_fingerprint: Option<String>,
103 #[serde(
105 rename = "stripeCustomerEmail",
106 skip_serializing_if = "Option::is_none"
107 )]
108 pub stripe_customer_email: Option<String>,
109 #[serde(rename = "referredByEmail", skip_serializing_if = "Option::is_none")]
111 pub referred_by_email: Option<String>,
112 #[serde(rename = "autoReloadPlan", skip_serializing_if = "Option::is_none")]
114 pub auto_reload_plan: Option<models::AutoReloadPlan>,
115 #[serde(rename = "minutesIncluded", skip_serializing_if = "Option::is_none")]
117 pub minutes_included: Option<f64>,
118 #[serde(rename = "minutesUsed", skip_serializing_if = "Option::is_none")]
120 pub minutes_used: Option<f64>,
121 #[serde(
123 rename = "minutesUsedNextResetAt",
124 skip_serializing_if = "Option::is_none"
125 )]
126 pub minutes_used_next_reset_at: Option<String>,
127 #[serde(rename = "minutesOverageCost", skip_serializing_if = "Option::is_none")]
129 pub minutes_overage_cost: Option<f64>,
130 #[serde(rename = "providersIncluded", skip_serializing_if = "Option::is_none")]
132 pub providers_included: Option<Vec<String>>,
133 #[serde(
135 rename = "outboundCallsDailyLimit",
136 skip_serializing_if = "Option::is_none"
137 )]
138 pub outbound_calls_daily_limit: Option<f64>,
139 #[serde(
141 rename = "outboundCallsCounter",
142 skip_serializing_if = "Option::is_none"
143 )]
144 pub outbound_calls_counter: Option<f64>,
145 #[serde(
147 rename = "outboundCallsCounterNextResetAt",
148 skip_serializing_if = "Option::is_none"
149 )]
150 pub outbound_calls_counter_next_reset_at: Option<String>,
151 #[serde(rename = "couponIds", skip_serializing_if = "Option::is_none")]
153 pub coupon_ids: Option<Vec<String>>,
154 #[serde(rename = "couponUsageLeft", skip_serializing_if = "Option::is_none")]
156 pub coupon_usage_left: Option<String>,
157 #[serde(rename = "invoicePlan", skip_serializing_if = "Option::is_none")]
159 pub invoice_plan: Option<models::InvoicePlan>,
160}
161
162impl Subscription {
163 pub fn new(
164 id: String,
165 created_at: String,
166 updated_at: String,
167 r#type: Type,
168 status: Status,
169 credits: String,
170 concurrency_counter: f64,
171 concurrency_limit_included: f64,
172 concurrency_limit_purchased: f64,
173 ) -> Subscription {
174 Subscription {
175 id,
176 created_at,
177 updated_at,
178 r#type,
179 status,
180 credits,
181 concurrency_counter,
182 concurrency_limit_included,
183 phone_numbers_counter: None,
184 phone_numbers_included: None,
185 concurrency_limit_purchased,
186 monthly_charge_schedule_id: None,
187 monthly_credit_check_schedule_id: None,
188 stripe_customer_id: None,
189 stripe_payment_method_id: None,
190 slack_support_enabled: None,
191 slack_channel_id: None,
192 hipaa_enabled: None,
193 hipaa_common_paper_agreement_id: None,
194 stripe_payment_method_fingerprint: None,
195 stripe_customer_email: None,
196 referred_by_email: None,
197 auto_reload_plan: None,
198 minutes_included: None,
199 minutes_used: None,
200 minutes_used_next_reset_at: None,
201 minutes_overage_cost: None,
202 providers_included: None,
203 outbound_calls_daily_limit: None,
204 outbound_calls_counter: None,
205 outbound_calls_counter_next_reset_at: None,
206 coupon_ids: None,
207 coupon_usage_left: None,
208 invoice_plan: None,
209 }
210 }
211}
212#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
214pub enum Type {
215 #[serde(rename = "trial")]
216 Trial,
217 #[serde(rename = "pay-as-you-go")]
218 PayAsYouGo,
219 #[serde(rename = "enterprise")]
220 Enterprise,
221}
222
223impl Default for Type {
224 fn default() -> Type {
225 Self::Trial
226 }
227}
228#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
230pub enum Status {
231 #[serde(rename = "active")]
232 Active,
233 #[serde(rename = "frozen")]
234 Frozen,
235}
236
237impl Default for Status {
238 fn default() -> Status {
239 Self::Active
240 }
241}