1686862fbSopenharmony_ci/*
2686862fbSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
3686862fbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4686862fbSopenharmony_ci * you may not use this file except in compliance with the License.
5686862fbSopenharmony_ci * You may obtain a copy of the License at
6686862fbSopenharmony_ci *
7686862fbSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8686862fbSopenharmony_ci *
9686862fbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10686862fbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11686862fbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12686862fbSopenharmony_ci * See the License for the specific language governing permissions and
13686862fbSopenharmony_ci * limitations under the License.
14686862fbSopenharmony_ci */
15686862fbSopenharmony_ci
16686862fbSopenharmony_ci#ifndef OHOS_DISTRIBUTED_BUNDLE_INFO_H
17686862fbSopenharmony_ci#define OHOS_DISTRIBUTED_BUNDLE_INFO_H
18686862fbSopenharmony_ci
19686862fbSopenharmony_ci#include <string>
20686862fbSopenharmony_ci#include <unordered_set>
21686862fbSopenharmony_ci
22686862fbSopenharmony_ci#include "dtbschedmgr_log.h"
23686862fbSopenharmony_ci#include "parcel.h"
24686862fbSopenharmony_ci
25686862fbSopenharmony_cinamespace OHOS {
26686862fbSopenharmony_cinamespace DistributedSchedule {
27686862fbSopenharmony_cistruct PublicRecordsInfo : public Parcelable {
28686862fbSopenharmony_ci    uint16_t maxBundleNameId = 0;
29686862fbSopenharmony_ci
30686862fbSopenharmony_ci    bool ReadFromParcel(Parcel &parcel);
31686862fbSopenharmony_ci    bool Marshalling(Parcel &parcel) const override;
32686862fbSopenharmony_ci    static PublicRecordsInfo *Unmarshalling(Parcel &parcel);
33686862fbSopenharmony_ci    std::string ToString() const;
34686862fbSopenharmony_ci    bool FromJsonString(const std::string &jsonString);
35686862fbSopenharmony_ci};
36686862fbSopenharmony_ci
37686862fbSopenharmony_cistruct DmsAbilityInfo : public Parcelable {
38686862fbSopenharmony_ci    std::string abilityName;
39686862fbSopenharmony_ci    std::vector<std::string> continueType;
40686862fbSopenharmony_ci    std::vector<uint8_t> continueTypeId;
41686862fbSopenharmony_ci    std::string moduleName;
42686862fbSopenharmony_ci    std::unordered_set<std::string> continueBundleName;
43686862fbSopenharmony_ci
44686862fbSopenharmony_ci    bool ReadFromParcel(Parcel &parcel);
45686862fbSopenharmony_ci    bool Marshalling(Parcel &parcel) const override;
46686862fbSopenharmony_ci    static DmsAbilityInfo *Unmarshalling(Parcel &parcel);
47686862fbSopenharmony_ci};
48686862fbSopenharmony_ci
49686862fbSopenharmony_cistruct DmsBundleInfo : public Parcelable {
50686862fbSopenharmony_ci    uint32_t version = 1;
51686862fbSopenharmony_ci    std::string bundleName;
52686862fbSopenharmony_ci    uint32_t versionCode = 0;
53686862fbSopenharmony_ci    std::string versionName;
54686862fbSopenharmony_ci    uint32_t minCompatibleVersion = 0;
55686862fbSopenharmony_ci    uint32_t targetVersionCode = 0;
56686862fbSopenharmony_ci    uint32_t compatibleVersionCode = 0;
57686862fbSopenharmony_ci    std::string appId;
58686862fbSopenharmony_ci    bool enabled = true;
59686862fbSopenharmony_ci    // user related fields, assign when calling the get interface
60686862fbSopenharmony_ci    uint16_t bundleNameId = 0;
61686862fbSopenharmony_ci    // bundle update time
62686862fbSopenharmony_ci    int64_t updateTime = 0;
63686862fbSopenharmony_ci    std::string developerId;
64686862fbSopenharmony_ci    std::vector<DmsAbilityInfo> dmsAbilityInfos;
65686862fbSopenharmony_ci    std::vector<uint8_t> userIdArr;
66686862fbSopenharmony_ci
67686862fbSopenharmony_ci    bool ReadFromParcel(Parcel &parcel);
68686862fbSopenharmony_ci    bool Marshalling(Parcel &parcel) const override;
69686862fbSopenharmony_ci    static DmsBundleInfo *Unmarshalling(Parcel &parcel);
70686862fbSopenharmony_ci    std::string ToString() const;
71686862fbSopenharmony_ci    bool FromJsonString(const std::string &jsonString);
72686862fbSopenharmony_ci};
73686862fbSopenharmony_ci} // namespace DistributedSchedule
74686862fbSopenharmony_ci} // namespace OHOS
75686862fbSopenharmony_ci#endif // OHOS_DISTRIBUTED_BUNDLE_INFO_H