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")]
16pub struct SupportReport {
17  #[builder(skip = ReportId::new())]
18  id: ReportId,
19  sender: Ruler,
20  receiver: Ruler,
21  origin: Coord,
22  destination: Coord,
23  personnel: ArmyPersonnel,
24  round: RoundId,
25  #[builder(skip = Zoned::now())]
26  time: Zoned,
27}
28
29impl SupportReport {
30  #[inline]
31  pub fn sender(&self) -> &Ruler {
32    &self.sender
33  }
34
35  #[inline]
36  pub fn receiver(&self) -> &Ruler {
37    &self.receiver
38  }
39
40  #[inline]
41  pub fn origin(&self) -> Coord {
42    self.origin
43  }
44
45  #[inline]
46  pub fn destination(&self) -> Coord {
47    self.destination
48  }
49
50  #[inline]
51  pub fn personnel(&self) -> &ArmyPersonnel {
52    &self.personnel
53  }
54}