1use rust_decimal::Decimal;
2use serde::{Deserialize, Serialize};
3use std::{fmt, ops::Deref};
4
5#[derive(
8 Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default, Serialize, Deserialize,
9)]
10#[serde(transparent)]
11pub struct Isk(#[serde(with = "rust_decimal::serde::arbitrary_precision")] pub Decimal);
12
13impl Deref for Isk {
14 type Target = Decimal;
15 fn deref(&self) -> &Decimal {
16 &self.0
17 }
18}
19
20impl fmt::Display for Isk {
21 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22 fmt::Display::fmt(&self.0, f)
23 }
24}
25
26impl From<Decimal> for Isk {
27 fn from(d: Decimal) -> Self {
28 Self(d)
29 }
30}
31
32impl From<Isk> for Decimal {
33 fn from(i: Isk) -> Self {
34 i.0
35 }
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40pub struct EsiResolvedName {
41 pub id: i64,
42 pub name: String,
43 pub category: String,
44}
45
46#[derive(Debug, Clone, Default, Serialize, Deserialize)]
48pub struct EsiResolvedIds {
49 #[serde(default)]
50 pub characters: Vec<EsiIdEntry>,
51 #[serde(default)]
52 pub corporations: Vec<EsiIdEntry>,
53 #[serde(default)]
54 pub alliances: Vec<EsiIdEntry>,
55 #[serde(default)]
56 pub systems: Vec<EsiIdEntry>,
57 #[serde(default)]
58 pub constellations: Vec<EsiIdEntry>,
59 #[serde(default)]
60 pub regions: Vec<EsiIdEntry>,
61 #[serde(default)]
62 pub stations: Vec<EsiIdEntry>,
63 #[serde(default)]
64 pub inventory_types: Vec<EsiIdEntry>,
65 #[serde(default)]
66 pub factions: Vec<EsiIdEntry>,
67 #[serde(default)]
68 pub agents: Vec<EsiIdEntry>,
69}
70
71impl EsiResolvedIds {
72 pub fn merge(&mut self, other: EsiResolvedIds) {
74 self.characters.extend(other.characters);
75 self.corporations.extend(other.corporations);
76 self.alliances.extend(other.alliances);
77 self.systems.extend(other.systems);
78 self.constellations.extend(other.constellations);
79 self.regions.extend(other.regions);
80 self.stations.extend(other.stations);
81 self.inventory_types.extend(other.inventory_types);
82 self.factions.extend(other.factions);
83 self.agents.extend(other.agents);
84 }
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize)]
89pub struct EsiIdEntry {
90 pub id: i64,
91 pub name: String,
92}
93
94#[derive(Debug, Clone, Default, Serialize, Deserialize)]
96pub struct EsiSearchResult {
97 #[serde(default)]
98 pub character: Vec<i64>,
99 #[serde(default)]
100 pub corporation: Vec<i64>,
101 #[serde(default)]
102 pub alliance: Vec<i64>,
103 #[serde(default)]
104 pub solar_system: Vec<i32>,
105 #[serde(default)]
106 pub constellation: Vec<i32>,
107 #[serde(default)]
108 pub region: Vec<i32>,
109 #[serde(default)]
110 pub station: Vec<i32>,
111 #[serde(default)]
112 pub inventory_type: Vec<i32>,
113 #[serde(default)]
114 pub agent: Vec<i64>,
115 #[serde(default)]
116 pub faction: Vec<i32>,
117}