1 #pragma once
2 #include <nlohmann/json.hpp>
3 
4 namespace resource
5 {
6 // clang-format off
7 
8 enum class State{
9     Invalid,
10     Enabled,
11     Disabled,
12     StandbyOffline,
13     StandbySpare,
14     InTest,
15     Starting,
16     Absent,
17     UnavailableOffline,
18     Deferring,
19     Quiesced,
20     Updating,
21     Qualified,
22     Degraded,
23 };
24 
25 enum class Health{
26     Invalid,
27     OK,
28     Warning,
29     Critical,
30 };
31 
32 enum class ResetType{
33     Invalid,
34     On,
35     ForceOff,
36     GracefulShutdown,
37     GracefulRestart,
38     ForceRestart,
39     Nmi,
40     ForceOn,
41     PushPowerButton,
42     PowerCycle,
43     Suspend,
44     Pause,
45     Resume,
46 };
47 
48 enum class IndicatorLED{
49     Invalid,
50     Lit,
51     Blinking,
52     Off,
53 };
54 
55 enum class PowerState{
56     Invalid,
57     On,
58     Off,
59     PoweringOn,
60     PoweringOff,
61     Paused,
62 };
63 
64 enum class DurableNameFormat{
65     Invalid,
66     NAA,
67     iQN,
68     FC_WWN,
69     UUID,
70     EUI,
71     NQN,
72     NSID,
73     NGUID,
74     MACAddress,
75     GCXLID,
76 };
77 
78 enum class RackUnits{
79     Invalid,
80     OpenU,
81     EIA_310,
82 };
83 
84 enum class LocationType{
85     Invalid,
86     Slot,
87     Bay,
88     Connector,
89     Socket,
90     Backplane,
91     Embedded,
92 };
93 
94 enum class Reference{
95     Invalid,
96     Top,
97     Bottom,
98     Front,
99     Rear,
100     Left,
101     Right,
102     Middle,
103 };
104 
105 enum class Orientation{
106     Invalid,
107     FrontToBack,
108     BackToFront,
109     TopToBottom,
110     BottomToTop,
111     LeftToRight,
112     RightToLeft,
113 };
114 
115 NLOHMANN_JSON_SERIALIZE_ENUM(State, {
116     {State::Invalid, "Invalid"},
117     {State::Enabled, "Enabled"},
118     {State::Disabled, "Disabled"},
119     {State::StandbyOffline, "StandbyOffline"},
120     {State::StandbySpare, "StandbySpare"},
121     {State::InTest, "InTest"},
122     {State::Starting, "Starting"},
123     {State::Absent, "Absent"},
124     {State::UnavailableOffline, "UnavailableOffline"},
125     {State::Deferring, "Deferring"},
126     {State::Quiesced, "Quiesced"},
127     {State::Updating, "Updating"},
128     {State::Qualified, "Qualified"},
129     {State::Degraded, "Degraded"},
130 });
131 
132 NLOHMANN_JSON_SERIALIZE_ENUM(Health, {
133     {Health::Invalid, "Invalid"},
134     {Health::OK, "OK"},
135     {Health::Warning, "Warning"},
136     {Health::Critical, "Critical"},
137 });
138 
139 NLOHMANN_JSON_SERIALIZE_ENUM(ResetType, {
140     {ResetType::Invalid, "Invalid"},
141     {ResetType::On, "On"},
142     {ResetType::ForceOff, "ForceOff"},
143     {ResetType::GracefulShutdown, "GracefulShutdown"},
144     {ResetType::GracefulRestart, "GracefulRestart"},
145     {ResetType::ForceRestart, "ForceRestart"},
146     {ResetType::Nmi, "Nmi"},
147     {ResetType::ForceOn, "ForceOn"},
148     {ResetType::PushPowerButton, "PushPowerButton"},
149     {ResetType::PowerCycle, "PowerCycle"},
150     {ResetType::Suspend, "Suspend"},
151     {ResetType::Pause, "Pause"},
152     {ResetType::Resume, "Resume"},
153 });
154 
155 NLOHMANN_JSON_SERIALIZE_ENUM(IndicatorLED, {
156     {IndicatorLED::Invalid, "Invalid"},
157     {IndicatorLED::Lit, "Lit"},
158     {IndicatorLED::Blinking, "Blinking"},
159     {IndicatorLED::Off, "Off"},
160 });
161 
162 NLOHMANN_JSON_SERIALIZE_ENUM(PowerState, {
163     {PowerState::Invalid, "Invalid"},
164     {PowerState::On, "On"},
165     {PowerState::Off, "Off"},
166     {PowerState::PoweringOn, "PoweringOn"},
167     {PowerState::PoweringOff, "PoweringOff"},
168     {PowerState::Paused, "Paused"},
169 });
170 
171 NLOHMANN_JSON_SERIALIZE_ENUM(DurableNameFormat, {
172     {DurableNameFormat::Invalid, "Invalid"},
173     {DurableNameFormat::NAA, "NAA"},
174     {DurableNameFormat::iQN, "iQN"},
175     {DurableNameFormat::FC_WWN, "FC_WWN"},
176     {DurableNameFormat::UUID, "UUID"},
177     {DurableNameFormat::EUI, "EUI"},
178     {DurableNameFormat::NQN, "NQN"},
179     {DurableNameFormat::NSID, "NSID"},
180     {DurableNameFormat::NGUID, "NGUID"},
181     {DurableNameFormat::MACAddress, "MACAddress"},
182     {DurableNameFormat::GCXLID, "GCXLID"},
183 });
184 
185 NLOHMANN_JSON_SERIALIZE_ENUM(RackUnits, {
186     {RackUnits::Invalid, "Invalid"},
187     {RackUnits::OpenU, "OpenU"},
188     {RackUnits::EIA_310, "EIA_310"},
189 });
190 
191 NLOHMANN_JSON_SERIALIZE_ENUM(LocationType, {
192     {LocationType::Invalid, "Invalid"},
193     {LocationType::Slot, "Slot"},
194     {LocationType::Bay, "Bay"},
195     {LocationType::Connector, "Connector"},
196     {LocationType::Socket, "Socket"},
197     {LocationType::Backplane, "Backplane"},
198     {LocationType::Embedded, "Embedded"},
199 });
200 
201 NLOHMANN_JSON_SERIALIZE_ENUM(Reference, {
202     {Reference::Invalid, "Invalid"},
203     {Reference::Top, "Top"},
204     {Reference::Bottom, "Bottom"},
205     {Reference::Front, "Front"},
206     {Reference::Rear, "Rear"},
207     {Reference::Left, "Left"},
208     {Reference::Right, "Right"},
209     {Reference::Middle, "Middle"},
210 });
211 
212 NLOHMANN_JSON_SERIALIZE_ENUM(Orientation, {
213     {Orientation::Invalid, "Invalid"},
214     {Orientation::FrontToBack, "FrontToBack"},
215     {Orientation::BackToFront, "BackToFront"},
216     {Orientation::TopToBottom, "TopToBottom"},
217     {Orientation::BottomToTop, "BottomToTop"},
218     {Orientation::LeftToRight, "LeftToRight"},
219     {Orientation::RightToLeft, "RightToLeft"},
220 });
221 
222 }
223 // clang-format on
224