Skip to main content

nil_core/report/
support.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use crate::continent::Coord;
5use crate::military::army::personnel::ArmyPersonnel;
6use crate::report::ReportId;
7use crate::round::RoundId;
8use crate::ruler::Ruler;
9use bon::Builder;
10use jiff::Zoned;
11use nil_core_macros::Report;
12use serde::{Deserialize, Serialize};
13
14#[derive(Report, Builder, Clone, Debug, Deserialize, Serialize)]
15#[serde(rename_all = "camelCase")]
16#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
17pub struct SupportReport {
18  #[builder(skip = ReportId::new())]
19  id: ReportId,
20  sender: Ruler,
21  receiver: Ruler,
22  origin: Coord,
23  destination: Coord,
24  personnel: ArmyPersonnel,
25  round: RoundId,
26  #[builder(skip = Zoned::now())]
27  time: Zoned,
28}
29
30impl SupportReport {
31  #[inline]
32  pub fn sender(&self) -> &Ruler {
33    &self.sender
34  }
35
36  #[inline]
37  pub fn receiver(&self) -> &Ruler {
38    &self.receiver
39  }
40
41  #[inline]
42  pub fn origin(&self) -> Coord {
43    self.origin
44  }
45
46  #[inline]
47  pub fn destination(&self) -> Coord {
48    self.destination
49  }
50
51  #[inline]
52  pub fn personnel(&self) -> &ArmyPersonnel {
53    &self.personnel
54  }
55}