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