Skip to main content

manabrew_protocol/prompts/
choose_blockers.rs

1use serde::{Deserialize, Serialize};
2use ts_rs::TS;
3
4use crate::prompts::common::BlockAssignment;
5
6#[derive(Debug, Clone, Serialize, Deserialize, TS)]
7#[serde(rename_all = "camelCase")]
8#[ts(export, export_to = "prompts/chooseBlockers.ts")]
9pub struct BlockableAttackerDto {
10    pub attacker_id: String,
11    pub valid_blocker_ids: Vec<String>,
12    #[ts(type = "number")]
13    pub min_blockers: u32,
14    #[serde(default, skip_serializing_if = "Option::is_none")]
15    #[ts(optional, type = "number")]
16    pub max_blockers: Option<u32>,
17    pub must_be_blocked: bool,
18}
19
20#[derive(Debug, Clone, Serialize, Deserialize, TS)]
21#[serde(rename_all = "camelCase")]
22#[ts(export, export_to = "prompts/chooseBlockers.ts")]
23pub struct ChooseBlockersInput {
24    pub attackers: Vec<BlockableAttackerDto>,
25    pub available_blocker_ids: Vec<String>,
26    #[serde(default, skip_serializing_if = "Option::is_none")]
27    #[ts(optional)]
28    pub error: Option<String>,
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize, TS)]
32#[serde(
33    tag = "type",
34    rename_all = "camelCase",
35    rename_all_fields = "camelCase"
36)]
37#[ts(export, export_to = "prompts/chooseBlockers.ts")]
38pub enum ChooseBlockersOutput {
39    DeclareBlockers { assignments: Vec<BlockAssignment> },
40}