manabrew_protocol/prompts/
choose_action.rs1use serde::{Deserialize, Serialize};
2use ts_rs::TS;
3
4use crate::game::StepKind;
5use crate::prompts::common::AvailableAction;
6
7#[derive(Debug, Clone, Serialize, Deserialize, TS)]
8#[serde(rename_all = "camelCase")]
9#[ts(export, export_to = "prompts/chooseAction.ts")]
10pub struct ChooseActionInput {
11 pub actions: Vec<AvailableAction>,
12}
13
14#[derive(Debug, Clone, Serialize, Deserialize, TS)]
15#[serde(rename_all = "camelCase")]
16#[ts(export, export_to = "prompts/chooseAction.ts")]
17pub struct PassUntil {
18 pub player_id: String,
19 pub phase: StepKind,
20 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
21 pub through_combat: bool,
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize, TS)]
25#[serde(
26 tag = "type",
27 rename_all = "camelCase",
28 rename_all_fields = "camelCase"
29)]
30#[ts(export, export_to = "prompts/chooseAction.ts")]
31pub enum ChooseActionOutput {
32 Pass {
33 #[serde(default, skip_serializing_if = "Option::is_none")]
34 #[ts(optional)]
35 until: Option<PassUntil>,
36 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
37 exhaust_stack: bool,
38 },
39 Act {
40 action_id: String,
41 },
42}