1 /*
2  * Copyright (c) 2024 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 OHOS_CLOUD_FILE_CLOUD_FILE_KIT_H
17 #define OHOS_CLOUD_FILE_CLOUD_FILE_KIT_H
18 
19 #include <memory>
20 
21 #include "cloud_assets_downloader.h"
22 #include "cloud_database.h"
23 #include "cloud_info.h"
24 #include "cloud_sync_helper.h"
25 #include "data_sync_manager.h"
26 #include "visibility.h"
27 
28 
29 namespace OHOS::FileManagement::CloudFile {
30 class API_EXPORT CloudFileKit {
31 public:
32     API_EXPORT static CloudFileKit *GetInstance();
33     API_EXPORT static bool RegisterCloudInstance(CloudFileKit *instance);
34 
35     virtual ~CloudFileKit() = default;
36     virtual int32_t GetCloudUserInfo(const int32_t userId, CloudUserInfo &userInfo);
37     virtual uint64_t GetRemainSpace(const int32_t userId);
38     virtual int32_t GetAppSwitchStatus(const std::string &bundleName, const int32_t userId, bool &switchStatus);
39     virtual int32_t ResolveNotificationEvent(const int32_t userId,
40                                              const std::string &extraData,
41                                              std::string &appBundleName,
42                                              std::string &prepareTraceId);
43     virtual int32_t GetAppConfigParams(const int32_t userId,
44                                        const std::string &bundleName,
45                                        std::map<std::string, std::string> &param);
46     virtual int32_t CleanCloudUserInfo(const int32_t userId);
47     virtual int32_t OnUploadAsset(const int32_t userId, const std::string &request, std::string &result);
48 
49     virtual std::shared_ptr<DataSyncManager> GetDataSyncManager();
50     virtual std::shared_ptr<CloudDatabase> GetCloudDatabase(const int32_t userId, const std::string &bundleName);
51     virtual std::shared_ptr<CloudAssetsDownloader> GetCloudAssetsDownloader(const int32_t userId,
52                                                                             const std::string &bundleName);
53     virtual std::shared_ptr<CloudSyncHelper> GetCloudSyncHelper(const int32_t userId, const std::string &bundleName);
54 
55 private:
56     static inline CloudFileKit *instance_;
57 };
58 } // namespace OHOS::FileManagement::CloudFile
59 
60 #endif // OHOS_CLOUD_FILE_CLOUD_FILE_KIT_H