1*80ad94fcSkasunath #pragma once
2*80ad94fcSkasunath 
3*80ad94fcSkasunath #include "bej_decoder_core.h"
4*80ad94fcSkasunath #include "rde_common.h"
5*80ad94fcSkasunath 
6*80ad94fcSkasunath #include <span>
7*80ad94fcSkasunath #include <string>
8*80ad94fcSkasunath #include <vector>
9*80ad94fcSkasunath 
10*80ad94fcSkasunath namespace libbej
11*80ad94fcSkasunath {
12*80ad94fcSkasunath 
13*80ad94fcSkasunath /**
14*80ad94fcSkasunath  * @brief Class for decoding RDE BEJ to a JSON output.
15*80ad94fcSkasunath  */
16*80ad94fcSkasunath class BejDecoderJson
17*80ad94fcSkasunath {
18*80ad94fcSkasunath 
19*80ad94fcSkasunath   public:
20*80ad94fcSkasunath     /**
21*80ad94fcSkasunath      * @brief Decode the encoded PLDM block.
22*80ad94fcSkasunath      *
23*80ad94fcSkasunath      * @param[in] dictionaries - dictionaries needed for decoding.
24*80ad94fcSkasunath      * @param[in] encodedPldmBlock - encoded PLDM block.
25*80ad94fcSkasunath      * @return 0 if successful.
26*80ad94fcSkasunath      */
27*80ad94fcSkasunath     int decode(const BejDictionaries& dictionaries,
28*80ad94fcSkasunath                const std::span<const uint8_t> encodedPldmBlock);
29*80ad94fcSkasunath 
30*80ad94fcSkasunath     /**
31*80ad94fcSkasunath      * @brief Get the JSON output related to the latest call to decode.
32*80ad94fcSkasunath      *
33*80ad94fcSkasunath      * @return std::string containing a JSON. If the decoding was
34*80ad94fcSkasunath      * unsuccessful, this might contain partial data (invalid JSON).
35*80ad94fcSkasunath      */
36*80ad94fcSkasunath     std::string getOutput();
37*80ad94fcSkasunath 
38*80ad94fcSkasunath   private:
39*80ad94fcSkasunath     bool isPrevAnnotated;
40*80ad94fcSkasunath     std::string output;
41*80ad94fcSkasunath     std::vector<BejStackProperty> stack;
42*80ad94fcSkasunath };
43*80ad94fcSkasunath 
44*80ad94fcSkasunath } // namespace libbej
45