Skip to main content

nil_payload/request/
report.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use nil_core::player::PlayerId;
5use nil_core::report::ReportId;
6use nil_core::world::config::WorldId;
7use serde::{Deserialize, Serialize};
8use std::collections::HashSet;
9
10#[cfg(feature = "typescript")]
11use ts_rs::TS;
12
13#[derive(Clone, Debug, Deserialize, Serialize)]
14#[serde(rename_all = "camelCase")]
15#[cfg_attr(feature = "typescript", derive(TS))]
16#[cfg_attr(feature = "typescript", ts(export))]
17pub struct ForwardReportRequest {
18  pub world: WorldId,
19  pub id: ReportId,
20  pub recipient: PlayerId,
21}
22
23#[derive(Clone, Debug, Deserialize, Serialize)]
24#[serde(rename_all = "camelCase")]
25#[cfg_attr(feature = "typescript", derive(TS))]
26#[cfg_attr(feature = "typescript", ts(export))]
27pub struct GetReportRequest {
28  pub world: WorldId,
29  pub id: ReportId,
30}
31
32#[derive(Clone, Debug, Deserialize, Serialize)]
33#[serde(rename_all = "camelCase")]
34#[cfg_attr(feature = "typescript", derive(TS))]
35#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
36pub struct GetReportsRequest {
37  pub world: WorldId,
38  pub ids: HashSet<ReportId>,
39  #[serde(default)]
40  pub limit: Option<usize>,
41}
42
43#[derive(Clone, Debug, Deserialize, Serialize)]
44#[serde(rename_all = "camelCase")]
45#[cfg_attr(feature = "typescript", derive(TS))]
46#[cfg_attr(feature = "typescript", ts(export))]
47pub struct RemoveReportRequest {
48  pub world: WorldId,
49  pub id: ReportId,
50}