1use bon::Builder;
5use nil_core::world::WorldOptions;
6use nil_core::world::config::WorldId;
7use nil_crypto::password::Password;
8use nil_server_types::round::RoundDuration;
9use serde::{Deserialize, Serialize};
10use std::path::PathBuf;
11
12#[cfg(feature = "typescript")]
13use ts_rs::TS;
14
15#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
16#[serde(rename_all = "camelCase")]
17#[cfg_attr(feature = "typescript", derive(TS))]
18#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
19pub struct CreateRemoteWorldRequest {
20 pub options: WorldOptions,
21 #[serde(default)]
22 #[builder(into)]
23 pub description: Option<String>,
24 #[serde(default)]
25 #[builder(into)]
26 pub password: Option<Password>,
27 #[serde(default)]
28 #[builder(into)]
29 pub round_duration: Option<RoundDuration>,
30}
31
32#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
33#[serde(rename_all = "camelCase")]
34#[cfg_attr(feature = "typescript", derive(TS))]
35#[cfg_attr(feature = "typescript", ts(export))]
36pub struct DeleteRemoteWorldRequest {
37 #[builder(start_fn, into)]
38 pub world: WorldId,
39}
40
41#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
42#[serde(rename_all = "camelCase")]
43#[cfg_attr(feature = "typescript", derive(TS))]
44#[cfg_attr(feature = "typescript", ts(export))]
45pub struct GetRemoteWorldRequest {
46 #[builder(start_fn, into)]
47 pub world: WorldId,
48}
49
50#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
51#[serde(rename_all = "camelCase")]
52#[cfg_attr(feature = "typescript", derive(TS))]
53#[cfg_attr(feature = "typescript", ts(export))]
54pub struct GetWorldBotsRequest {
55 #[builder(start_fn, into)]
56 pub world: WorldId,
57}
58
59#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
60#[serde(rename_all = "camelCase")]
61#[cfg_attr(feature = "typescript", derive(TS))]
62#[cfg_attr(feature = "typescript", ts(export))]
63pub struct GetWorldConfigRequest {
64 #[builder(start_fn, into)]
65 pub world: WorldId,
66}
67
68#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
69#[serde(rename_all = "camelCase")]
70#[cfg_attr(feature = "typescript", derive(TS))]
71#[cfg_attr(feature = "typescript", ts(export))]
72pub struct GetWorldPersonnelRequest {
73 #[builder(start_fn, into)]
74 pub world: WorldId,
75}
76
77#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
78#[serde(rename_all = "camelCase")]
79#[cfg_attr(feature = "typescript", derive(TS))]
80#[cfg_attr(feature = "typescript", ts(export))]
81pub struct GetWorldPlayersRequest {
82 #[builder(start_fn, into)]
83 pub world: WorldId,
84}
85
86#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
87#[serde(rename_all = "camelCase")]
88#[cfg_attr(feature = "typescript", derive(TS))]
89#[cfg_attr(feature = "typescript", ts(export))]
90pub struct GetWorldPrecursorsRequest {
91 #[builder(start_fn, into)]
92 pub world: WorldId,
93}
94
95#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
96#[serde(rename_all = "camelCase")]
97#[cfg_attr(feature = "typescript", derive(TS))]
98#[cfg_attr(feature = "typescript", ts(export))]
99pub struct GetWorldStatsRequest {
100 #[builder(start_fn, into)]
101 pub world: WorldId,
102}
103
104#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
105#[serde(rename_all = "camelCase")]
106#[cfg_attr(feature = "typescript", derive(TS))]
107#[cfg_attr(feature = "typescript", ts(export))]
108pub struct LeaveRequest {
109 #[builder(start_fn, into)]
110 pub world: WorldId,
111}
112
113#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
114#[serde(rename_all = "camelCase")]
115#[cfg_attr(feature = "typescript", derive(TS))]
116#[cfg_attr(feature = "typescript", ts(export))]
117pub struct SaveLocalWorldRequest {
118 #[builder(start_fn, into)]
119 pub world: WorldId,
120 #[builder(into)]
121 pub path: PathBuf,
122}