User.h
1 /*
2  * Copyright 2016 Gigatribe
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef GIGA_DATA_USER_MODEL_H_
18 #define GIGA_DATA_USER_MODEL_H_
19 
20 #include <cpprest/details/basic_types.h>
21 #include <vector>
22 #include <map>
23 #include "../../rest/prepoc_manage.h"
24 
25 #include "Node.h"
26 #include "RsaKey.h"
27 #include "ExternalAccount.h"
28 #include "Offer.h"
29 
30 namespace giga {
31 namespace data {
32 
36 struct User {
37  uint64_t id = 0;
38  utility::string_t login = {};
40  uint64_t creationDate = 0;
42  boost::optional<uint64_t> lastConnectionDate = boost::none;
43  utility::string_t activity = {};
44  bool isUnlimited = {};
45  boost::optional<utility::string_t> gender = boost::none;
47  boost::optional<utility::string_t> birthDate = boost::none;
48  boost::optional<utility::string_t> description = boost::none;
49  utility::string_t avatarUrl = {};
50  utility::string_t bigAvatarUrl = {};
51  uint64_t contactCount = 0;
52  boost::optional<uint64_t> maxContact = boost::none;
53  std::vector<utility::string_t> tags = {};
54  utility::string_t isSeeder = {};
56  boost::optional<bool> isBot = boost::none;
58  boost::optional<std::string> publicKey = boost::none;
60  boost::optional<utility::string_t> country = boost::none;
62  boost::optional<utility::string_t> language = boost::none;
64  boost::optional<utility::string_t> name = boost::none;
66  std::shared_ptr<Node> node = nullptr;
68  boost::optional<utility::string_t> reportedState = boost::none;
70  boost::optional<std::string> nodeKey = boost::none;
72  std::unique_ptr<RsaKey> rsaKeys = nullptr;
74  boost::optional<std::string> salt = boost::none;
76  boost::optional<utility::string_t> email = boost::none;
78  boost::optional<utility::string_t> nextEmail = boost::none;
80  boost::optional<uint64_t> maxStorage = boost::none;
82  boost::optional<uint64_t> standatdMaxStorage = boost::none;
84  boost::optional<uint64_t> achievements = boost::none;
86  std::vector<std::unique_ptr<ExternalAccount>> externalAccounts = {};
88  boost::optional<uint64_t> downloaded = boost::none;
90  std::unique_ptr<Offer> offer = nullptr;
92  boost::optional<uint64_t> dlAvailable = boost::none;
94  boost::optional<uint64_t> starCount = boost::none;
95 
96  template <class Manager>
97  void visit(const Manager& m) {
98  GIGA_MANAGE(m, id);
99  GIGA_MANAGE(m, login);
100  GIGA_MANAGE(m, creationDate);
101  GIGA_MANAGE(m, lastConnectionDate);
102  GIGA_MANAGE(m, activity);
103  GIGA_MANAGE(m, isUnlimited);
104  GIGA_MANAGE(m, gender);
105  GIGA_MANAGE(m, birthDate);
106  GIGA_MANAGE(m, description);
107  GIGA_MANAGE(m, avatarUrl);
108  GIGA_MANAGE(m, bigAvatarUrl);
109  GIGA_MANAGE(m, contactCount);
110  GIGA_MANAGE(m, maxContact);
111  GIGA_MANAGE(m, tags);
112  GIGA_MANAGE(m, isSeeder);
113  GIGA_MANAGE(m, isBot);
114  GIGA_MANAGE(m, publicKey);
115  GIGA_MANAGE(m, country);
116  GIGA_MANAGE(m, language);
117  GIGA_MANAGE(m, name);
118  GIGA_MANAGE(m, node);
119  GIGA_MANAGE(m, reportedState);
120  GIGA_MANAGE(m, nodeKey);
121  GIGA_MANAGE(m, rsaKeys);
122  GIGA_MANAGE(m, salt);
123  GIGA_MANAGE(m, email);
124  GIGA_MANAGE(m, nextEmail);
125  GIGA_MANAGE(m, maxStorage);
126  GIGA_MANAGE(m, standatdMaxStorage);
127  GIGA_MANAGE(m, achievements);
128  GIGA_MANAGE(m, externalAccounts);
129  GIGA_MANAGE(m, downloaded);
130  GIGA_MANAGE(m, offer);
131  GIGA_MANAGE(m, dlAvailable);
132  GIGA_MANAGE(m, starCount);
133  }
134 };
135 
136 } /* namespace data */
137 } /* namespace giga */
138 #endif /* GIGA_DATA_USER_MODEL_H_ */
boost::optional< uint64_t > starCount
Definition: User.h:94
boost::optional< uint64_t > achievements
Definition: User.h:84
boost::optional< utility::string_t > language
Definition: User.h:62
std::shared_ptr< Node > node
Definition: User.h:66
boost::optional< uint64_t > dlAvailable
Definition: User.h:92
boost::optional< uint64_t > downloaded
Definition: User.h:88
std::vector< std::unique_ptr< ExternalAccount > > externalAccounts
Definition: User.h:86
boost::optional< utility::string_t > email
Definition: User.h:76
std::unique_ptr< RsaKey > rsaKeys
Definition: User.h:72
boost::optional< std::string > salt
Definition: User.h:74
boost::optional< uint64_t > standatdMaxStorage
Definition: User.h:82
boost::optional< std::string > nodeKey
Definition: User.h:70
boost::optional< bool > isBot
Definition: User.h:56
boost::optional< utility::string_t > country
Definition: User.h:60
boost::optional< uint64_t > lastConnectionDate
Definition: User.h:42
boost::optional< std::string > publicKey
Definition: User.h:58
std::unique_ptr< Offer > offer
Definition: User.h:90
boost::optional< utility::string_t > reportedState
Definition: User.h:68
boost::optional< utility::string_t > nextEmail
Definition: User.h:78
boost::optional< utility::string_t > birthDate
Definition: User.h:47
uint64_t creationDate
Definition: User.h:40
boost::optional< uint64_t > maxStorage
Definition: User.h:80
boost::optional< utility::string_t > name
Definition: User.h:64
Definition: User.h:36