#include "sidebar-main-deps.h"

namespace UkuiNotification {

NotificationCenterWindow::NotificationCenterWindow(QWindow *parent)
    : UkuiQuick::SharedEngineView(parent)
{
}

NotificationGroupModel *NotificationCenterWindow::globalGroupModel()
{
    static NotificationGroupModel model;
    if (!model.sourceModel()) {
        model.setSourceModel(NotificationModel::instance());
    }
    return &model;
}

void NotificationCenterWindow::init()
{
    m_inited = true;
}

void NotificationCenterWindow::activeNotificationCenter(bool active)
{
    m_lastActive = active;
    if (isVisible() == active) {
        return;
    }
    setProperty("_test_visible", active);
    Q_EMIT visibleChanged(active);
}

bool NotificationCenterWindow::lastActive() const
{
    return m_lastActive;
}

bool NotificationCenterWindow::inited() const
{
    return m_inited;
}

bool NotificationCenterWindow::isVisible() const
{
    return property("_test_visible").toBool();
}

} // namespace UkuiNotification
