import QtQuick
import QtQuick.Layouts
import ZShell.Config
import qs.Components
import qs.Modules.Bar.Components.Common
import qs.Helpers
import qs.Services

WidgetBase {
	id: root

	property int countUpdates: Updates.availableUpdates
	property color textColor: Colors.palette.m3onSurface

	color: Colors.tPalette.m3surfaceContainer
	implicitHeight: horizontal ? baseSize : content.implicitHeight + Tokens.spacing.small
	implicitWidth: horizontal ? content.implicitWidth + Tokens.spacing.small * 2 : baseSize
	radius: Tokens.rounding.full

	GridLayout {
		id: content

		anchors.centerIn: parent
		columnSpacing: Tokens.spacing.small
		columns: root.horizontal ? -1 : 1
		rowSpacing: -Tokens.spacing.extraSmall / 2

		MaterialIcon {
			Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
			font.pointSize: root.horizontal ? Tokens.font.size.larger : Tokens.font.size.large
			text: "package_2"
		}

		CustomText {
			Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
			color: root.textColor
			font.pointSize: Tokens.font.size.normal
			text: root.countUpdates
		}
	}
}
