1use essences::abilities::AbilityId;
2use essences::bundles::BundleId;
3use essences::currency::CurrencyId;
4use essences::items::ItemTemplateId;
5use schema_loader::{
6 ability_link_id_schema, bundle_id_schema, currency_link_id_schema, item_link_id_schema,
7};
8use schemars::JsonSchema;
9
10use serde::{Deserialize, Serialize};
11use tsify_next::Tsify;
12
13use crate::validated_types::{NonEmptyVec, NonZeroU64, PositiveF64, PositiveI64};
14
15#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, Tsify)]
16pub struct CurrencyRate {
17 #[schemars(title = "Id валюты", schema_with = "currency_link_id_schema")]
18 pub currency_id: CurrencyId,
19
20 #[schemars(title = "Количество валюты в минуту")]
21 pub rate_per_minute: PositiveF64,
22}
23
24#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, Tsify)]
25pub enum AfkRewardBonusType {
26 #[schemars(title = "Валюта", schema_with = "currency_link_id_schema")]
27 Currency(CurrencyId),
28
29 #[schemars(title = "Способность", schema_with = "ability_link_id_schema")]
30 Ability(AbilityId),
31
32 #[schemars(title = "Предмет", schema_with = "item_link_id_schema")]
33 Item(ItemTemplateId),
34}
35
36#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, Tsify)]
37pub struct AfkRewardBonusWeight {
38 #[schemars(title = "Тип бонуса")]
39 pub bonus_type: AfkRewardBonusType,
40
41 #[schemars(title = "Вес")]
42 pub weight: PositiveF64,
43
44 #[schemars(title = "Количество")]
45 pub count: PositiveI64,
46}
47
48#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, Tsify)]
49pub struct AfkRewardsByLevel {
50 #[schemars(title = "Уровень главы кампании")]
51 pub chapter_level: i64,
52
53 #[schemars(title = "Обязательная награда в валюте")]
54 pub currency_rates: Vec<CurrencyRate>,
55
56 #[schemars(title = "Бонусные награды")]
57 pub bonus_weights: NonEmptyVec<AfkRewardBonusWeight>,
58}
59
60#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, Tsify)]
61pub struct AfkRewardsSettings {
62 #[schemars(title = "Бандл для афк награды", schema_with = "bundle_id_schema")]
63 pub bundle_id: BundleId,
64
65 #[schemars(title = "Минимально необходимое время накопления (сек)")]
66 pub min_required_time_sec: u64,
67
68 #[schemars(title = "Максимально возможное время накопления (сек)")]
69 pub max_possible_time_sec: u64,
70
71 #[schemars(title = "Частота расчёта бонусов (сек)")]
72 pub bonus_calculation_rate_sec: NonZeroU64,
73
74 #[schemars(title = "Длительность мгновенной AFK-награды (сек)")]
75 pub instant_reward_duration_sec: u64,
76
77 #[schemars(
78 title = "Стоимость мгновенной AFK-награды за гемы по нажатиям (индекс = номер нажатия, значение = цена в гемах)"
79 )]
80 pub instant_reward_gems_prices: Vec<i64>,
81
82 #[schemars(title = "Максимальное количество мгновенных AFK-наград за рекламу в день")]
83 pub afk_instant_ad_daily_limit: u64,
84}