Skip to main content

appstruct_ir/
billing.rs

1use serde::{Deserialize, Serialize};
2
3/// Billing facts known at compile time. Provider secrets are deliberately not part of the IR.
4#[allow(clippy::struct_excessive_bools)]
5#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
6pub struct BillingIr {
7    pub enabled: bool,
8    #[serde(default, skip_serializing_if = "Option::is_none")]
9    pub provider: Option<String>,
10    #[serde(default, skip_serializing_if = "std::ops::Not::not")]
11    pub subscriptions: bool,
12    #[serde(default, skip_serializing_if = "std::ops::Not::not")]
13    pub trials: bool,
14    #[serde(default, skip_serializing_if = "std::ops::Not::not")]
15    pub customer_portal: bool,
16    #[serde(default, skip_serializing_if = "std::ops::Not::not")]
17    pub metered_usage: bool,
18    #[serde(default, skip_serializing_if = "Vec::is_empty")]
19    pub plans: Vec<BillingPlanIr>,
20}
21
22#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
23pub struct BillingPlanIr {
24    pub id: String,
25    pub price_env: String,
26    #[serde(default, skip_serializing_if = "Option::is_none")]
27    pub trial_days: Option<u16>,
28    #[serde(default, skip_serializing_if = "Vec::is_empty")]
29    pub entitlements: Vec<String>,
30}