X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frest%2Fmodel%2FSubscriptionDetail.h;fp=src%2Frest%2Fmodel%2FSubscriptionDetail.h;h=1651619224f74263c0f46f0cfe3c9365dd6aafde;hb=a0bada6bf7af92d281c381092e7d6881c67d905f;hp=0000000000000000000000000000000000000000;hpb=488447aed60cc52b06d71d50bee4ecf10025f7e1;p=ric-plt%2Fxapp-frame-cpp.git diff --git a/src/rest/model/SubscriptionDetail.h b/src/rest/model/SubscriptionDetail.h new file mode 100644 index 0000000..1651619 --- /dev/null +++ b/src/rest/model/SubscriptionDetail.h @@ -0,0 +1,71 @@ +#ifndef XAPP_MODEL_SubscriptionDetail_H +#define XAPP_MODEL_SubscriptionDetail_H +#include "ModelBase.h" +#include "ActionToBeSetup.h" + +namespace xapp { +namespace model { + +using EventTriggerDefinition = std::vector; + +struct SubscriptionDetail: ModelBase { + ActionsToBeSetup ActionToBeSetupList; + EventTriggerDefinition EventTriggers; + int XappEventInstanceID; + json validator_schema = R"( + { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Subscription detail", + "properties": { + "XappEventInstanceId": { + "type": "integer", + "minimum": 0, + "maximum": 255 + }, + "EventTriggers": { + "description": "Identification of Action", + "type": "array", + "items": { + "type": "integer" + } + }, + "ActionToBeSetupList": { + "type": "array" + } + }, + "required": [ + "XappEventInstanceId", + "EventTriggers", + "ActionToBeSetupList" + ], + "type": "object" + })"_json; + + virtual json get_validator_schema() const { return validator_schema; } + +}; + +void from_json(const json& j, SubscriptionDetail& ref) { + + std::cout << __PRETTY_FUNCTION__ << std::endl; + ref.validate_json(j); + + j.at("XappEventInstanceId").get_to(ref.XappEventInstanceID); + j.at("EventTriggers").get_to(ref.EventTriggers); + j.at("ActionToBeSetupList").get_to(ref.ActionToBeSetupList); +} + +void to_json(json& j, const SubscriptionDetail& ref) { + + j = json { + {"XappEventInstanceId", ref.XappEventInstanceID}, + {"EventTriggers", ref.EventTriggers}, + {"ActionToBeSetupList", ref.ActionToBeSetupList}, + }; +} + +using SubscriptionDetailsList = std::vector; + +} /*namespace model*/ +} /*namespace xapp*/ +#endif /*XAPP_MODEL_SubscriptionDetail_H*/