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 
17 #ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_UNIFIED_GROUP_INFO_H
18 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_UNIFIED_GROUP_INFO_H
19 
20 #include "parcel.h"
21 #include "want_params.h"
22 #include <string>
23 
24 namespace OHOS {
25 namespace Notification {
26 class NotificationUnifiedGroupInfo : public Parcelable {
27 public:
28     NotificationUnifiedGroupInfo() = default;
29 
30     ~NotificationUnifiedGroupInfo() = default;
31 
32     /**
33      * @brief Obtains the key of unified group info.
34      *
35      * @return Returns the key that aggregated across applications.
36      */
37     std::string GetKey() const;
38 
39     /**
40      * @brief Set the key of unified group info.
41      *
42      * @param key Indicates the key of unified group info.
43      */
44     void SetKey(const std::string &key);
45 
46     /**
47      * @brief Obtains the title of unified group info.
48      *
49      * @return Returns the title that aggregated across applications.
50      */
51     std::string GetTitle() const;
52 
53     /**
54      * @brief Set the title of unified group info.
55      *
56      * @param title the title of unified group info.
57      */
58     void SetTitle(const std::string &title);
59 
60     /**
61      * @brief Obtains the content of unified group info.
62      *
63      * @return Returns the content that aggregated across applications.
64      */
65     std::string GetContent() const;
66 
67     /**
68      * @brief Set the content of unified group info.
69      *
70      * @param content the content of unified group info.
71      */
72     void SetContent(const std::string &content);
73 
74     /**
75      * @brief Obtains the sceneName of unified group info.
76      *
77      * @return Returns the sceneName of aggregation scenario.
78      */
79     std::string GetSceneName() const;
80 
81     /**
82      * @brief Set the sceneName of unified group info.
83      *
84      * @param sceneName the sceneName of unified group info.
85      */
86     void SetSceneName(const std::string &sceneName);
87 
88     /**
89      * @brief Obtains the WantParams object set in the unified group info.
90      *
91      * @return Returns the WantParams object.
92      */
93     std::shared_ptr<AAFwk::WantParams> GetExtraInfo() const;
94 
95     /**
96      * @brief Sets extra parameters that are stored as key-value pairs for the unified group info.
97      *
98      * @param extras Indicates the WantParams object containing the extra parameters in key-value pair format.
99      */
100     void SetExtraInfo(const std::shared_ptr<AAFwk::WantParams> &extras);
101 
102     /**
103      * @brief Returns a string representation of the object.
104      *
105      * @return Returns a string representation of the object.
106      */
107     std::string Dump();
108 
109     /**
110      * @brief Marshal a object into a Parcel.
111      *
112      * @param parcel Indicates the object into the parcel.
113      * @return Returns true if succeed; returns false otherwise.
114      */
115     virtual bool Marshalling(Parcel &parcel) const override;
116 
117     /**
118      * @brief Unmarshal object from a Parcel.
119      *
120      * @param parcel Indicates the parcel object.
121      * @return Returns the NotificationUnifiedGroupInfo.
122      */
123     static NotificationUnifiedGroupInfo *Unmarshalling(Parcel &parcel);
124 
125 private:
126     /**
127      * @brief Read a NotificationUnifiedGroupInfo object from a Parcel.
128      *
129      * @param parcel Indicates the parcel object.
130      * @return Returns true if succeed; returns false otherwise.
131      */
132     bool ReadFromParcel(Parcel &parcel);
133 
134 private:
135     std::string key_ {};
136     std::string title_ {};
137     std::string content_ {};
138     std::string sceneName_ {};
139     std::shared_ptr<AAFwk::WantParams> extraInfo_ {};
140 };
141 }  // namespace Notification
142 }  // namespace OHOS
143 
144 #endif  // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_UNIFIED_GROUP_INFO_H
145