Skip to main content

manabrew_protocol/prompts/
choose_action.rs

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