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_DISTRIBUTED_BUNDLE_INFO_H
17#define OHOS_DISTRIBUTED_BUNDLE_INFO_H
18
19#include <string>
20#include <unordered_set>
21
22#include "dtbschedmgr_log.h"
23#include "parcel.h"
24
25namespace OHOS {
26namespace DistributedSchedule {
27struct PublicRecordsInfo : public Parcelable {
28    uint16_t maxBundleNameId = 0;
29
30    bool ReadFromParcel(Parcel &parcel);
31    bool Marshalling(Parcel &parcel) const override;
32    static PublicRecordsInfo *Unmarshalling(Parcel &parcel);
33    std::string ToString() const;
34    bool FromJsonString(const std::string &jsonString);
35};
36
37struct DmsAbilityInfo : public Parcelable {
38    std::string abilityName;
39    std::vector<std::string> continueType;
40    std::vector<uint8_t> continueTypeId;
41    std::string moduleName;
42    std::unordered_set<std::string> continueBundleName;
43
44    bool ReadFromParcel(Parcel &parcel);
45    bool Marshalling(Parcel &parcel) const override;
46    static DmsAbilityInfo *Unmarshalling(Parcel &parcel);
47};
48
49struct DmsBundleInfo : public Parcelable {
50    uint32_t version = 1;
51    std::string bundleName;
52    uint32_t versionCode = 0;
53    std::string versionName;
54    uint32_t minCompatibleVersion = 0;
55    uint32_t targetVersionCode = 0;
56    uint32_t compatibleVersionCode = 0;
57    std::string appId;
58    bool enabled = true;
59    // user related fields, assign when calling the get interface
60    uint16_t bundleNameId = 0;
61    // bundle update time
62    int64_t updateTime = 0;
63    std::string developerId;
64    std::vector<DmsAbilityInfo> dmsAbilityInfos;
65    std::vector<uint8_t> userIdArr;
66
67    bool ReadFromParcel(Parcel &parcel);
68    bool Marshalling(Parcel &parcel) const override;
69    static DmsBundleInfo *Unmarshalling(Parcel &parcel);
70    std::string ToString() const;
71    bool FromJsonString(const std::string &jsonString);
72};
73} // namespace DistributedSchedule
74} // namespace OHOS
75#endif // OHOS_DISTRIBUTED_BUNDLE_INFO_H