#ifndef ASH_ASSISTANT_MODEL_ASSISTANT_NOTIFICATION_MODEL_H_
#define ASH_ASSISTANT_MODEL_ASSISTANT_NOTIFICATION_MODEL_H_
#include <map>
#include <string>
#include <vector>
#include "base/component_export.h"
#include "base/observer_list.h"
#include "chromeos/ash/services/libassistant/public/cpp/assistant_notification.h"
namespace ash {
class AssistantNotificationModelObserver;
class COMPONENT_EXPORT(ASSISTANT_MODEL) AssistantNotificationModel {
public:
using AssistantNotification = assistant::AssistantNotification;
AssistantNotificationModel();
AssistantNotificationModel(const AssistantNotificationModel&) = delete;
AssistantNotificationModel& operator=(const AssistantNotificationModel&) =
delete;
~AssistantNotificationModel();
void AddObserver(AssistantNotificationModelObserver* observer) const;
void RemoveObserver(AssistantNotificationModelObserver* observer) const;
void AddOrUpdateNotification(AssistantNotification&& notification);
void RemoveNotificationById(const std::string& id, bool from_server);
void RemoveNotificationsByGroupingKey(const std::string& grouping_key,
bool from_server);
void RemoveAllNotifications(bool from_server);
const AssistantNotification* GetNotificationById(const std::string& id) const;
std::vector<const AssistantNotification*> GetNotifications() const;
bool HasNotificationForId(const std::string& id) const;
private:
void NotifyNotificationAdded(const AssistantNotification& notification);
void NotifyNotificationUpdated(const AssistantNotification& notification);
void NotifyNotificationRemoved(const AssistantNotification& notification,
bool from_server);
void NotifyAllNotificationsRemoved(bool from_server);
std::map<std::string, AssistantNotification> notifications_;
mutable base::ObserverList<AssistantNotificationModelObserver> observers_;
};
}
#endif