Skip to main content

manabrew_protocol/prompts/
choose_action.rs

1use 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}
21
22#[derive(Debug, Clone, Serialize, Deserialize, TS)]
23#[serde(
24    tag = "type",
25    rename_all = "camelCase",
26    rename_all_fields = "camelCase"
27)]
28#[ts(export, export_to = "prompts/chooseAction.ts")]
29pub enum ChooseActionOutput {
30    Pass {
31        #[serde(default, skip_serializing_if = "Option::is_none")]
32        #[ts(optional)]
33        until: Option<PassUntil>,
34        #[serde(default, skip_serializing_if = "std::ops::Not::not")]
35        exhaust_stack: bool,
36    },
37    RestoreSnapshot {
38        #[ts(type = "number")]
39        checkpoint_id: u64,
40    },
41    Act {
42        action_id: String,
43    },
44}