import QtQuick
import QtQuick.Layouts
import qs.Components
import ZShell.Config
import qs.Helpers
import qs.Services

ColumnLayout {
	id: root

	required property int rootHeight

	spacing: Tokens.spacing.extraSmall

	CustomText {
		Layout.alignment: Qt.AlignHCenter
		animate: true
		color: Colors.palette.m3onSurfaceVariant
		font.pointSize: Tokens.font.size.large
		text: Weather.description
	}

	RowLayout {
		Layout.alignment: Qt.AlignHCenter
		spacing: Tokens.spacing.small

		CustomText {
			id: temp

			animate: true
			color: Colors.palette.m3primary
			font.pointSize: Tokens.font.size.large
			text: Weather.temp
		}

		MaterialIcon {
			animate: true
			color: Colors.palette.m3secondary
			text: Weather.icon
		}
	}

	CustomText {
		Layout.alignment: Qt.AlignHCenter
		animate: true
		color: Colors.palette.m3onSurfaceVariant
		font.pointSize: Tokens.font.size.large
		text: qsTr("Feels like %1").arg(Weather.temp)
		visible: root.rootHeight > 550
	}

	CustomText {
		Layout.alignment: Qt.AlignHCenter
		animate: true
		color: Colors.palette.m3onSurfaceVariant
		font.pointSize: Tokens.font.size.normal
		text: {
			const today = Weather.forecast[0];
			return qsTr("High %1 • Low %2").arg(Weather.formatTemp(today?.maxTempC)).arg(Weather.formatTemp(today?.minTempC));
		}
		visible: root.rootHeight > 550
	}
}
