2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef NOTIFICATION_EX_CHAT_MESSAGE_ITEM_H_
18 #define NOTIFICATION_EX_CHAT_MESSAGE_ITEM_H_
26 #include "notification-ex/abstract_item.h"
27 #include "notification-ex/text_item.h"
28 #include "notification-ex/image_item.h"
29 #include "notification-ex/time_item.h"
31 namespace notification {
35 * @brief The class for ChatMessageItem type notification.
36 * @details The class to make the chat message type notification.
39 class EXPORT_API ChatMessageItem : public AbstractItem {
50 * @param[in] id The ChatMessageItem id
51 * @param[in] name The name of chat message
52 * @param[in] text The text of chat message
53 * @param[in] image The image of chat message
54 * @param[in] time The time of chat message
55 * @param[in] type The type of chat message
56 * @param[in] action The action for ChatMessageItem
58 ChatMessageItem(std::string id, std::shared_ptr<TextItem> name,
59 std::shared_ptr<TextItem> text, std::shared_ptr<ImageItem> image,
60 std::shared_ptr<TimeItem> time, Type type,
61 std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}));
67 virtual ~ChatMessageItem();
70 * @brief Gets the type of ChatMessageItem.
72 * @return AbstractItem::Type::ChatMessage
74 int GetType() const override;
77 * @brief Serialize the data of ChatMessageItem.
79 * @return Bundle type data
81 tizen_base::Bundle Serialize() const override;
84 * @brief Deserialize the serialized data.
86 * @param[in] b The serialized Bundle data
88 void Deserialize(tizen_base::Bundle b) override;
91 * @brief Finds the AbstractItem using by notification item id.
93 * @param[in] id notification item id
94 * @return AbstractItem object
96 AbstractItem& FindByID(std::string id) override;
99 * @brief Finds the AbstractItem using by main type.
101 * @param[in] type The main type
102 * @return AbstractItem object
104 AbstractItem& FindByMainType(MainType type) override;
107 * @brief Checks the item type exist in this notification.
109 * @param[in] type notification item type
110 * @return true if the item type exists
112 bool IsItemTypeExist(int type) override;
115 * @brief Gets the path of shared file location.
117 * @return The list of shared path.
119 std::list<std::string> GetSharedPath() const override;
122 * @brief Gets the name data of ChatMessageItem.
124 * @return The TextItem type name data
126 TextItem& GetNameItem() const;
129 * @brief Gets the text data of ChatMessageItem.
131 * @return The TextItem type text data
133 TextItem& GetTextItem() const;
136 * @brief Gets the image data of ChatMessageItem.
138 * @return The ImageItem type image data
140 ImageItem& GetImageItem() const;
143 * @brief Gets the time data of ChantMessageItem.
145 * @return The TimeItem type time data
147 TimeItem& GetTimeItem() const;
150 * @brief Gets the type of message.
152 * @return ChatMessageItem::Type::sender or ChatMessageItem::Type::user
154 Type GetMessageType() const;
158 std::unique_ptr<Impl> impl_;
159 }; // class ChatMessageItem
162 } // namespace notification
163 #endif // NOTIFICATION_EX_CHAT_MESSAGE_ITEM_H_