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_NOTIFICATION_UTILS_H
17 #define OHOS_NOTIFICATION_UTILS_H
18 
19 #include "cj_ffi/cj_common_ffi.h"
20 
21 namespace OHOS {
22 namespace CJSystemapi {
23 
24 constexpr int32_t STR_MAX_SIZE = 204;
25 constexpr int32_t LONG_STR_MAX_SIZE = 1028;
26 constexpr int32_t EOK = 0;
27 
28 struct CNotificationBasicContent {
29     char* title;
30     char* text;
31     char* additionalText;
32 };
33 
34 struct CNotificationLongTextContent {
35     char* title;
36     char* text;
37     char* additionalText;
38     char* longText;
39     char* briefText;
40     char* expandedTitle;
41 };
42 
43 struct CNotificationMultiLineContent {
44     char* title;
45     char* text;
46     char* additionalText;
47     char* briefText;
48     char* longTitle;
49     CArrString lines;
50 };
51 
52 struct CNotificationPictureContent {
53     char* title;
54     char* text;
55     char* additionalText;
56     char* briefText;
57     char* expandedTitle;
58     int64_t picture;
59 };
60 
61 struct CNotificationContent {
62     int32_t notificationContentType;
63     CNotificationBasicContent* normal;
64     CNotificationLongTextContent* longText;
65     CNotificationMultiLineContent* multiLine;
66     CNotificationPictureContent* picture;
67 };
68 
69 struct CDistributedOptions {
70     bool isDistributed;
71     CArrString supportDisplayDevices;
72     CArrString supportOperateDevices;
73 };
74 
75 enum class ContentType {
76     NOTIFICATION_CONTENT_BASIC_TEXT,
77     NOTIFICATION_CONTENT_LONG_TEXT,
78     NOTIFICATION_CONTENT_PICTURE,
79     NOTIFICATION_CONTENT_CONVERSATION,
80     NOTIFICATION_CONTENT_MULTILINE,
81     NOTIFICATION_CONTENT_LOCAL_LIVE_VIEW,
82     NOTIFICATION_CONTENT_LIVE_VIEW
83 };
84 
85 enum class SlotType {
86     UNKNOWN_TYPE = 0,
87     SOCIAL_COMMUNICATION = 1,
88     SERVICE_INFORMATION = 2,
89     CONTENT_INFORMATION = 3,
90     LIVE_VIEW = 4,
91     CUSTOMER_SERVICE = 5,
92     OTHER_TYPES = 0xFFFF,
93 };
94 
95 struct CNotificationRequest {
96     CNotificationContent notificationContent;
97     int32_t id;
98     int32_t notificationSlotType;
99     bool isOngoing;
100     bool isUnremovable;
101     int64_t deliveryTime;
102     bool tapDismissed;
103     int64_t autoDeletedTime;
104     uint32_t color;
105     bool colorEnabled;
106     bool isAlertOnce;
107     bool isStopwatch;
108     bool isCountDown;
109     char* label;
110     int32_t badgeIconStyle;
111     bool showDeliveryTime;
112     int64_t smallIcon;
113     int64_t largeIcon;
114     char* creatorBundleName;
115     char* groupName;
116     CDistributedOptions* distributedOption;
117     int32_t badgeNumber;
118 };
119 } // namespace CJSystemapi
120 } // namespace OHOS
121 
122 #endif // OHOS_NOTIFICATION_UTILS_H