1/*
2 * Copyright (c) 2021 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 BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_TEMPLATE_H
17#define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_TEMPLATE_H
18
19#include <memory>
20#include <string>
21#include "parcel.h"
22#include "want_params.h"
23
24namespace OHOS {
25namespace Notification {
26class NotificationTemplate : public Parcelable {
27public:
28    /**
29     * Default constructor used to create an empty NotificationTemplate instance.
30     */
31    NotificationTemplate() = default;
32
33    /**
34     * Default deconstructor used to deconstruct.
35     */
36    ~NotificationTemplate() = default;
37
38    /**
39     * Sets the template name to be included in a template notification.
40     * @param name template name.
41     */
42    void SetTemplateName(const std::string &name);
43
44    /**
45     * Obtains the template name to be included in a template notification.
46     * @return template name.
47     */
48    std::string GetTemplateName() const;
49
50    /**
51     * Sets the template data to be included in a template notification.
52     * @param data template data.
53     */
54    void SetTemplateData(const std::shared_ptr<AAFwk::WantParams> &data);
55
56    /**
57     * Obtains the template data to be included in a template notification.
58     * @return template data.
59     */
60    std::shared_ptr<AAFwk::WantParams> GetTemplateData() const;
61
62    /**
63     * Returns a string representation of the object.
64     * @return a string representation of the object.
65     */
66    std::string Dump();
67
68    /**
69     * Marshal a object into a Parcel.
70     * @param parcel the object into the parcel
71     */
72    virtual bool Marshalling(Parcel &parcel) const override;
73
74    /**
75     * Unmarshal object from a Parcel.
76     * @return the NotificationTemplate
77     */
78    static NotificationTemplate *Unmarshalling(Parcel &parcel);
79
80private:
81    /**
82     * Read a NotificationTemplate object from a Parcel.
83     * @param parcel the parcel
84     */
85    bool ReadFromParcel(Parcel &parcel);
86
87private:
88    std::string templateName_;
89    std::shared_ptr<AAFwk::WantParams> templateData_ {};
90};
91}  // namespace Notification
92}  // namespace OHOS
93
94#endif  // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_TEMPLATE_H
95
96