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 #ifndef OHOS_MEDIA_BACKUP_UPGRADE_RESTORE_GALLERY_MEDIA_TASK_H
16 #define OHOS_MEDIA_BACKUP_UPGRADE_RESTORE_GALLERY_MEDIA_TASK_H
17 
18 #include <string>
19 #include <vector>
20 
21 #include "media_backup_report_data_type.h"
22 
23 namespace OHOS::Media {
24 class UpgradeRestoreGalleryMediaTask {
25 public:
SetSceneCode(int32_t sceneCode)26     UpgradeRestoreGalleryMediaTask &SetSceneCode(int32_t sceneCode)
27     {
28         this->sceneCode_ = sceneCode;
29         return *this;
30     }
SetTaskId(const std::string & taskId)31     UpgradeRestoreGalleryMediaTask &SetTaskId(const std::string &taskId)
32     {
33         this->taskId_ = taskId;
34         return *this;
35     }
36     std::vector<MediaRestoreResultInfo> LoadTask(const std::string &taskInfo);
37     MediaRestoreResultInfo Load(const std::string &type, const std::string &errorCode, const std::string &errorInfo);
38 
39 private:
40     CallbackResultData ParseFromJsonStr(const std::string &jsonStr);
41     std::vector<MediaRestoreResultInfo> Parse(const CallbackResultData &resultData);
42 
43 private:
44     int32_t sceneCode_;
45     std::string taskId_;
46 };
47 }  // namespace OHOS::Media
48 #endif  // OHOS_MEDIA_BACKUP_UPGRADE_RESTORE_TASK_REPORT_H