use serde::Deserialize;
use std::collections::HashMap;
#[derive(Deserialize, Debug)]
pub struct SubscriptionLevelResponse {
pub data: Vec<SubscriptionLevel>,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct SubscriptionLevel {
pub id: u64,
pub name: String,
pub price: f64,
pub currency_prices: HashMap<String, f64>,
pub is_limited: bool,
pub is_archived: bool,
pub deleted: bool,
pub is_hidden: bool,
pub created_at: i64,
pub owner_id: u64,
pub promos: Vec<Promo>,
pub data: Vec<DataBlock>,
pub external_apps: ExternalApps,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Promo {
pub id: u64,
#[serde(rename = "type")]
pub type_: String,
pub description: Option<String>,
pub start_time: i64,
pub end_time: Option<i64>,
pub is_finished: bool,
pub access: Access,
pub count: Count,
pub discount: Discount,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Access {
pub access_other_level_subscriber: bool,
pub new_subscriber: bool,
pub old_paid_subscriber: bool,
}
#[derive(Deserialize, Debug)]
pub struct Count {
pub activation: u64,
pub max_activation: Option<u64>,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Discount {
pub price: u64,
pub percent: u32,
#[serde(rename = "currencyPrices")]
pub currency_prices: HashMap<String, f64>,
}
#[derive(Deserialize, Debug)]
#[serde(tag = "type")]
pub enum DataBlock {
#[serde(rename_all = "camelCase")]
#[serde(rename = "text")]
Text {
content: String,
modificator: String,
},
#[serde(rename_all = "camelCase")]
#[serde(rename = "image")]
Image {
id: String,
url: String,
rendition: String,
width: u32,
height: u32,
size: u64,
},
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct ExternalApps {
pub discord: DiscordApp,
pub telegram: TelegramApp,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct DiscordApp {
pub is_configured: bool,
pub data: Option<DiscordData>,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct DiscordData {
pub role: DiscordRole,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct DiscordRole {
pub id: String,
pub name: String,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct TelegramApp {
pub is_configured: bool,
}