1use serde::{Deserialize, Serialize};
2use ts_rs::TS;
3
4use crate::game::{Mana, TargetingIntent};
5
6#[derive(Debug, Clone, Serialize, Deserialize, TS)]
7#[serde(rename_all = "camelCase")]
8#[ts(export, export_to = "prompts/common.ts")]
9pub struct PromptPresentation {
10 pub title: String,
11 #[serde(default, skip_serializing_if = "Option::is_none")]
12 #[ts(optional)]
13 pub description: Option<String>,
14 #[serde(default, skip_serializing_if = "Option::is_none")]
15 #[ts(optional)]
16 pub text: Option<String>,
17 #[serde(default)]
18 pub targets: Vec<TargetRef>,
19}
20
21#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]
23#[serde(rename_all = "camelCase")]
24#[ts(export, export_to = "prompts/common.ts")]
25pub enum AlternativeCostKind {
26 Flashback,
27 Spectacle,
28 Evoke,
29 Dash,
30 Blitz,
31 Escape,
32 Overload,
33 Madness,
34 Foretell,
35 Emerge,
36 Suspend,
37 Morph,
38 Megamorph,
39 Bestow,
40 Warp,
41 SacrificeAlt,
42 Plot,
43 Awaken,
44 Disturb,
45 Harmonize,
46 Freerunning,
47 Impending,
48 Mayhem,
49 #[serde(rename = "moreThanMeetsTheEye")]
50 MTMtE,
51 Mutate,
52 Prowl,
53 Sneak,
54 Surge,
55 WebSlinging,
56 Plotted,
57}
58
59#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]
61#[serde(
62 tag = "type",
63 rename_all = "camelCase",
64 rename_all_fields = "camelCase"
65)]
66#[ts(export, export_to = "prompts/common.ts")]
67pub enum PlayCardMode {
68 Normal,
69 BackFaceLand,
70 RoomRightSplit,
71 Alternative { cost: AlternativeCostKind },
72 StaticAlternative,
73 ForetellExile,
74 UnlockDoor,
75}
76
77#[derive(Debug, Clone, Serialize, Deserialize, TS)]
78#[serde(rename_all = "camelCase")]
79#[ts(export, export_to = "prompts/common.ts")]
80pub struct ActivatableAbilityInfo {
81 pub card_id: String,
82 pub ability_index: usize,
83 pub description: String,
84 pub is_mana_ability: bool,
85 #[serde(default, skip_serializing_if = "Option::is_none")]
86 #[ts(optional)]
87 pub cost: Option<String>,
88 #[serde(default, skip_serializing_if = "Option::is_none")]
89 #[ts(optional)]
90 pub produced_mana: Option<Vec<Mana>>,
91}
92
93#[derive(Debug, Clone, Serialize, Deserialize, TS)]
94#[serde(
95 tag = "type",
96 rename_all = "camelCase",
97 rename_all_fields = "camelCase"
98)]
99#[ts(export, export_to = "prompts/common.ts")]
100pub enum AvailableActionKind {
101 Cast {
102 card_id: String,
103 mode: PlayCardMode,
104 label: String,
105 },
106 ActivateAbility(ActivatableAbilityInfo),
107 UndoMana {
108 card_id: String,
109 },
110}
111
112#[derive(Debug, Clone, Serialize, Deserialize, TS)]
113#[ts(export, export_to = "prompts/common.ts")]
114pub struct AvailableAction {
115 pub id: String,
116 #[serde(flatten)]
117 #[ts(flatten)]
118 pub kind: AvailableActionKind,
119}
120
121#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]
122#[serde(rename_all = "camelCase")]
123#[ts(export, export_to = "prompts/common.ts")]
124pub enum PaymentResourceKind {
125 Convoke,
126 Improvise,
127 Delve,
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize, TS)]
131#[serde(
132 tag = "type",
133 rename_all = "camelCase",
134 rename_all_fields = "camelCase"
135)]
136#[ts(export, export_to = "prompts/common.ts")]
137pub enum PaymentActionKind {
138 ActivateManaAbility(ActivatableAbilityInfo),
139 UndoMana {
140 card_id: String,
141 },
142 UseResource {
143 card_id: String,
144 resource: PaymentResourceKind,
145 },
146 ReleaseResource {
147 card_id: String,
148 resource: PaymentResourceKind,
149 },
150 PayLife {
151 amount: u32,
152 },
153}
154
155#[derive(Debug, Clone, Serialize, Deserialize, TS)]
156#[ts(export, export_to = "prompts/common.ts")]
157pub struct PaymentAction {
158 pub id: String,
159 #[serde(flatten)]
160 #[ts(flatten)]
161 pub kind: PaymentActionKind,
162}
163
164#[derive(Debug, Clone, Serialize, Deserialize, TS)]
165#[serde(rename_all = "camelCase")]
166#[ts(export, export_to = "prompts/common.ts")]
167pub enum AttackTargetKind {
168 Player,
169 Planeswalker,
170 Battle,
171}
172
173#[derive(Debug, Clone, Serialize, Deserialize, TS)]
174#[serde(rename_all = "camelCase")]
175#[ts(export, export_to = "prompts/common.ts")]
176pub struct AttackTargetDto {
177 pub id: String,
178 pub label: String,
179 pub kind: AttackTargetKind,
180}
181
182#[derive(Debug, Clone, Serialize, Deserialize, TS)]
183#[serde(rename_all = "camelCase")]
184#[ts(export, export_to = "prompts/common.ts")]
185pub struct BlockAssignment {
186 pub blocker_id: String,
187 pub attacker_id: String,
188}
189
190#[derive(Debug, Clone, Serialize, Deserialize, TS)]
191#[serde(rename_all = "camelCase")]
192#[ts(export, export_to = "prompts/common.ts")]
193pub struct AttackAssignment {
194 pub attacker_id: String,
195 pub target_id: String,
196}
197
198#[derive(Debug, Clone, Serialize, Deserialize, TS)]
199#[serde(rename_all = "camelCase")]
200#[ts(export, export_to = "prompts/common.ts")]
201pub struct CombatDamageAssignmentEntry {
202 pub assignee_id: String,
203 pub damage: i32,
204}
205
206#[derive(Debug, Clone, Serialize, Deserialize, TS)]
207#[serde(
208 tag = "kind",
209 rename_all = "camelCase",
210 rename_all_fields = "camelCase"
211)]
212#[ts(export, export_to = "prompts/common.ts")]
213pub enum TargetAnyChoice {
214 Player { player_id: String },
215 Card { card_id: String },
216 None,
217}
218
219#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]
220#[serde(rename_all = "camelCase")]
221#[ts(export, export_to = "prompts/common.ts")]
222pub enum TargetKind {
223 Player,
224 Card,
225 Spell,
226}
227
228#[derive(Debug, Clone, Serialize, Deserialize, TS)]
229#[serde(rename_all = "camelCase")]
230#[ts(export, export_to = "prompts/common.ts")]
231pub struct TargetRef {
232 pub kind: TargetKind,
233 pub id: String,
234 #[serde(default, skip_serializing_if = "Option::is_none")]
235 #[ts(optional)]
236 pub intent: Option<TargetingIntent>,
237 #[serde(default, skip_serializing_if = "Option::is_none")]
238 #[ts(optional)]
239 pub oracle: Option<String>,
240}