RIC-641 Fixing client/server model definitions and adding client and server API
[ric-plt/xapp-frame-cpp.git] / src / model / ActionToBeSetup.h
1 /*
2 # ==================================================================================
3 # Copyright (c) 2020 HCL Technologies Limited.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ==================================================================================
17 */
18 #ifndef _ActionToBeSetupList_H
19 #define _ActionToBeSetupList_H
20 #include"SubsequentAction.h"
21
22 namespace xapp
23 {
24         namespace model
25         {
26                 struct ActionToBeSetup: public ModelBase
27                 {
28                         int ActionID{0};
29                         std::string ActionType{""};
30                         //std::string SubsequentActionType{""};
31                         //std::string TimeToWait{""};
32                         SubsequentAction m_SubsequentAction; 
33                         std::vector<int> ActionDefinition{};
34
35                         nlohmann::json validator_schema = R"(
36                         {
37                         "$schema": "http://json-schema.org/draft-07/schema#",
38                         "title": "ActionToBeSetup",
39                         "properties": {
40                             "ActionDefinition": {
41                                 "description": "Action Definition",
42                                 "type": "array",
43                                 "items": {
44                                     "type": "integer"
45                                 }
46                             },
47                             "ActionID": {
48                                 "description": "Identification of Action",
49                                 "type": "integer",
50                                 "minimum": 0,
51                                 "maximum": 255
52                             },
53                             "ActionType": {
54                                 "description": "Type of Action",
55                                 "type": "string",
56                                 "enum": ["policy", "insert", "report"]
57                             },
58                             "SubsequentAction": {
59                                 "description": "Subsequent Action",
60                                 "type": "object"
61                             }
62                         },
63                         "required": [
64                                      "ActionID",
65                                      "ActionType"
66                                     ],
67                         "type": "object"
68                         })"_json;
69
70                         virtual nlohmann::json get_validator_schema() const { return validator_schema; }
71
72                 };
73
74                 void from_json(const nlohmann::json & j, ActionToBeSetup& ref);
75                 void from_json(const nlohmann::json & j, std::vector<ActionToBeSetup>& ref);
76                 void to_json(nlohmann::json& j, const ActionToBeSetup& ref);
77                 void to_json(nlohmann::json& j, const std::vector<ActionToBeSetup>& ref);
78
79         }
80         
81 }
82
83
84 #endif
85