use bon::Builder;
use nil_core::player::{PlayerId, PlayerOptions, PlayerStatus};
use nil_core::world::config::WorldId;
use nil_crypto::password::Password;
use nil_payload_macros::FromWorld;
use serde::{Deserialize, Serialize};
#[derive(Builder, Clone, Debug, Deserialize, Serialize, FromWorld)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
#[cfg_attr(feature = "typescript", ts(export))]
pub struct GetPlayerRequest {
#[builder(start_fn, into)]
pub world: WorldId,
}
#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
#[cfg_attr(feature = "typescript", ts(export))]
pub struct GetPlayerCoordsRequest {
#[builder(start_fn, into)]
pub world: WorldId,
#[builder(into)]
pub id: PlayerId,
}
#[derive(Builder, Clone, Debug, Deserialize, Serialize, FromWorld)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
#[cfg_attr(feature = "typescript", ts(export))]
pub struct GetPlayerIdsRequest {
#[builder(start_fn, into)]
pub world: WorldId,
}
#[derive(Builder, Clone, Debug, Deserialize, Serialize, FromWorld)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
#[cfg_attr(feature = "typescript", ts(export))]
pub struct GetPlayerMaintenanceRequest {
#[builder(start_fn, into)]
pub world: WorldId,
}
#[derive(Builder, Clone, Debug, Deserialize, Serialize, FromWorld)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
#[cfg_attr(feature = "typescript", ts(export))]
pub struct GetPlayerMilitaryRequest {
#[builder(start_fn, into)]
pub world: WorldId,
}
#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
#[cfg_attr(feature = "typescript", ts(export))]
pub struct GetPlayerStatusRequest {
#[builder(start_fn, into)]
pub world: WorldId,
#[builder(into)]
pub id: PlayerId,
}
#[derive(Builder, Clone, Debug, Deserialize, Serialize, FromWorld)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
#[cfg_attr(feature = "typescript", ts(export))]
pub struct GetPlayerStorageCapacityRequest {
#[builder(start_fn, into)]
pub world: WorldId,
}
#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
#[cfg_attr(feature = "typescript", ts(export))]
pub struct GetPlayerWorldsRequest {
#[builder(into)]
pub id: PlayerId,
}
#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
#[cfg_attr(feature = "typescript", ts(export))]
pub struct GetPublicPlayerRequest {
#[builder(start_fn, into)]
pub world: WorldId,
#[builder(into)]
pub id: PlayerId,
}
#[derive(Builder, Clone, Debug, Deserialize, Serialize, FromWorld)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
#[cfg_attr(feature = "typescript", ts(export))]
pub struct GetPublicPlayersRequest {
#[builder(start_fn, into)]
pub world: WorldId,
}
#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
#[cfg_attr(feature = "typescript", ts(export))]
pub struct PlayerExistsRequest {
#[builder(start_fn, into)]
pub world: WorldId,
#[builder(into)]
pub id: PlayerId,
}
#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
#[cfg_attr(feature = "typescript", ts(export))]
pub struct SetPlayerStatusRequest {
#[builder(start_fn, into)]
pub world: WorldId,
pub status: PlayerStatus,
}
#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
pub struct SpawnPlayerRequest {
#[builder(start_fn, into)]
pub world: WorldId,
#[serde(default)]
#[builder(into)]
pub world_password: Option<Password>,
pub options: PlayerOptions,
}