1 /* 2 * Copyright (c) 2025 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 #ifndef OS_ACCOUNT_FRAMEWORK_OS_ACCOUNT_INFO_JSON_PARSER_H 16 #define OS_ACCOUNT_FRAMEWORK_OS_ACCOUNT_INFO_JSON_PARSER_H 17 18 #include "json_utils.h" 19 #include "os_account_info.h" 20 21 namespace OHOS { 22 namespace AccountSA { 23 namespace { 24 const char LOCAL_ID[] = "localId"; 25 const char LOCAL_NAME[] = "localName"; 26 const char SHORT_NAME[] = "shortName"; 27 const char TYPE[] = "type"; 28 const char CONSTRAINTS[] = "constraints"; 29 const char IS_OS_ACCOUNT_VERIFIED[] = "isVerified"; 30 const char PHOTO[] = "photo"; 31 const char CREATE_TIME[] = "createTime"; 32 const char LAST_LOGGED_IN_TIME[] = "lastLoginTime"; 33 const char SERIAL_NUMBER[] = "serialNumber"; 34 const char IS_ACTIVATED[] = "isActived"; 35 const char IS_ACCOUNT_COMPLETED[] = "isCreateCompleted"; 36 const char DOMAIN_INFO[] = "domainInfo"; 37 const char DOMAIN_NAME[] = "domain"; 38 const char DOMAIN_ACCOUNT_NAME[] = "accountName"; 39 const char DOMAIN_ACCOUNT_ID[] = "accountId"; 40 const char TO_BE_REMOVED[] = "toBeRemoved"; 41 const char CREDENTIAL_ID[] = "credentialId"; 42 const char DISPLAY_ID[] = "displayId"; 43 const char IS_FOREGROUND[] = "isForeground"; 44 const char IS_LOGGED_IN[] = "isLoggedIn"; 45 const char IS_DATA_REMOVABLE[] = "isDataRemovable"; 46 const char CREATOR_TYPE[] = "creatorType"; 47 const char DOMAIN_ACCOUNT_STATUS[] = "domainAccountStatus"; 48 const char DOMAIN_ACCOUNT_CONFIG[] = "domainServerConfigId"; 49 constexpr int32_t ALLOWED_HAP_LIST_MAX_SIZE = 1000; 50 } // namespace 51 CJsonUnique ToJson(const OsAccountInfo &accountInfo); 52 bool FromJson(cJSON *jsonObject, OsAccountInfo &accountInfo); 53 CJsonUnique ToJson(const DomainAccountInfo &domainInfo); 54 bool FromJson(cJSON *jsonObject, DomainAccountInfo &domainInfo); 55 } // namespace AccountSA 56 } // namespace OHOS 57 58 #endif // OS_ACCOUNT_FRAMEWORK_OS_ACCOUNT_INFO_JSON_PARSER_H