#ifndef NOTIFICATIONDBUS_H
#define NOTIFICATIONDBUS_H

#include <QObject>
#include <QMap>
#include <QDateTime>
#include "../gsettingmanager.h"

#define DBUS_INTERFACE "org.ukui.Sidebar.notification"

class NotificationPlugin;

class NotificationDbus : public QObject
{
    Q_OBJECT
    //申明该类有D-BUS服务接口
    Q_CLASSINFO("D-Bus Interface", "org.ukui.Sidebar.notification")

public:
    NotificationDbus(NotificationPlugin *parent);
    void fromSettingsGetInfoToList();

    int m_NotificationCenterHeight = 0;
    int m_NotificationCenterWidth = 0;

    int m_NotificationNum = 0;

signals:
    void Sig_Notify(QString appName, QString appIcon,
                    QString summary, QString body,
                    QString urlStr,  QString actions,
                    QDateTime dateTime, int nMaxNum);

    void Sig_CloseAppMsg(QString strAppName);
    void Sig_UpdateAppMaxNum(QString strAppName, int maxNum);
    void Sig_NotificationNumChange();

public slots:
    void sidebarNotification(const QString &appName,const QString &appIcon,
                             const QString &summary,const QString &body,
                             const QString &urlStr, const QString &actions); //创建一条侧边栏通知
    void appNotifySettingChangedSlot();

    //通知中心
    void setNotificationCenterHeight(int height);
    void setNotificationCenterWidth(int width);

    int getNotificationCenterHeight();
    int getNotificationCenterWidth();

    void sendNotificationNumChangeSignal();
    void addNotificationNum();
    void subNotificationNum();
    void clearNotificationNum();

    int getNotificationNum();

private:
    NotificationPlugin*     m_parent;           //传一个插件对象指针，用来回传槽函数
    QMap<QString, int>      m_nAppMaxNum;
    QMap<QString, bool>     m_mapAppSwitch;
};

#endif // NOTIFICATIONDBUS_H
