1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef DISTRIBUTEDDATAMGR_USER_META_DATA_H 17 #define DISTRIBUTEDDATAMGR_USER_META_DATA_H 18 #include <string> 19 #include <vector> 20 21 #include "serializable/serializable.h" 22 namespace OHOS::DistributedData { 23 class API_EXPORT UserStatus final : public Serializable { 24 public: 25 int32_t id; 26 bool isActive; 27 API_EXPORT UserStatus() = default; 28 API_EXPORT ~UserStatus() = default; 29 API_EXPORT UserStatus(int id, bool isActive); 30 API_EXPORT bool Marshal(json &node) const override; 31 API_EXPORT bool Unmarshal(const json &node) override; 32 }; 33 34 class API_EXPORT UserMetaData final : public Serializable { 35 public: 36 std::string deviceId; 37 std::vector<UserStatus> users; 38 39 API_EXPORT bool Marshal(json &node) const override; 40 API_EXPORT bool Unmarshal(const json &node) override; 41 }; 42 43 class UserMetaRow { 44 public: 45 API_EXPORT static constexpr const char *KEY_PREFIX = "UserMeta"; 46 API_EXPORT static std::string GetKeyFor(const std::string &key); 47 }; 48 } // namespace OHOS::DistributedData 49 50 #endif // DISTRIBUTEDDATAMGR_USER_META_DATA_H 51