import QtQuick
import qs.config
import qs.services

Rectangle {
    id: root

    signal activated

    visible: Notifs.hasNotifications
    implicitHeight: visible ? 62 : 0
    radius: Theme.cardRadius
    border.width: 0
    color: summaryMouse.containsMouse ? Theme.alpha(Theme.fg, 0.10) : Theme.alpha(Theme.fg, 0.055)

    Behavior on color { ColorAnimation { duration: Theme.durFast } }

    Column {
        anchors.left: parent.left
        anchors.leftMargin: 14
        anchors.verticalCenter: parent.verticalCenter
        spacing: 3

        Text {
            text: Notifs.history.length + (Notifs.history.length === 1 ? " notification" : " notifications")
            color: Theme.fg
            font.family: Theme.fontFamily
            font.pixelSize: Theme.fontSize
            font.weight: Font.DemiBold
        }

        Text {
            text: "Grouped quietly until you open them"
            color: Theme.fgDim
            font.family: Theme.fontFamily
            font.pixelSize: Theme.fontSizeSmall
        }
    }

    Text {
        anchors.right: parent.right
        anchors.rightMargin: 14
        anchors.verticalCenter: parent.verticalCenter
        text: "View  →"
        color: Theme.fgDim
        font.family: Theme.fontFamily
        font.pixelSize: Theme.fontSizeSmall
        font.weight: Font.Medium
    }

    MouseArea {
        id: summaryMouse
        anchors.fill: parent
        hoverEnabled: true
        cursorShape: Qt.PointingHandCursor
        onClicked: root.activated()
    }
}
