X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frest%2Fmodel%2FSubsequentAction.h;fp=src%2Frest%2Fmodel%2FSubsequentAction.h;h=094357961f29c3dc3f15cd9b96cbcf9bac712beb;hb=a0bada6bf7af92d281c381092e7d6881c67d905f;hp=0000000000000000000000000000000000000000;hpb=488447aed60cc52b06d71d50bee4ecf10025f7e1;p=ric-plt%2Fxapp-frame-cpp.git diff --git a/src/rest/model/SubsequentAction.h b/src/rest/model/SubsequentAction.h new file mode 100644 index 0000000..0943579 --- /dev/null +++ b/src/rest/model/SubsequentAction.h @@ -0,0 +1,59 @@ +#ifndef XAPP_MODEL_SubsequentAction_H +#define XAPP_MODEL_SubsequentAction_H +#include "ModelBase.h" + +namespace xapp { +namespace model { + +struct SubsequentAction: ModelBase { + std::string SubsequentActionType; + std::string TimeToWait; + json validator_schema = R"( + { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SubsequentAction", + "properties": { + "SubsequentActionType": { + "description": "Type of Subsequent Action", + "type": "string", + "enum": ["wait", "continue"] + + }, + "TimeToWait": { + "description": "Time to waiting", + "type": "string", + "enum": ["zero", "w1ms", "w2ms", "w5ms", "w10ms", "w20ms", "w30ms", + "w40ms", "w50ms", "w100ms", "w200ms", "w500ms", "w1s", + "w2s", "w5s", "w10s", "w20s", "w60s"] + } + }, + "required": [ + "SubsequentActionType", + "TimeToWait" + ], + "type": "object" + })"_json; + + virtual json get_validator_schema() const { return validator_schema; } +}; + +void from_json(const json& j, SubsequentAction& ref) { + + std::cout << __PRETTY_FUNCTION__ << "\n"; + ref.validate_json(j); + + j.at("SubsequentActionType").get_to(ref.SubsequentActionType); + j.at("TimeToWait").get_to(ref.TimeToWait); +} + +void to_json(json& j, const SubsequentAction& ref) { + + j = json { + {"SubsequentActionType",ref.SubsequentActionType}, + {"TimeToWait", ref.TimeToWait} + }; +} + +} /*model*/ +} /*xapp*/ +#endif /*XAPP_MODEL_SubsequentAction_H*/