#pragma once

#include "configlist.hpp"
#include "configobject.hpp"
#include <qcontainerfwd.h>
#include <qhashfunctions.h>
#include <qqmlregistration.h>

namespace ZShell::config {

class BarEntry : public ListEntry {
	Q_OBJECT
	QML_ANONYMOUS

	public:
	explicit BarEntry(QObject* parent = nullptr) : ListEntry(parent) {}
};

class Popouts : public ConfigObject {
	Q_OBJECT
	QML_ANONYMOUS

	CFG_PROPERTY(bool, statusIcons, true)
	CFG_PROPERTY(bool, tray, true)

	public:
	explicit Popouts(QObject* parent = nullptr) : ConfigObject(parent) {}
};

class Tray : public ConfigObject {
	Q_OBJECT
	QML_ANONYMOUS

	CFG_PROPERTY(bool, recolorIcons, false)
	CFG_PROPERTY(bool, showOnHover, true)
	CFG_PROPERTY(int, trayIconSize, 24)
	CONFIG_LIST(
		EntryList,
		statusIcons,
		{
			LIST_ENTRY(audio, true),
			LIST_ENTRY(microphone, true),
			LIST_ENTRY(bluetooth, false),
			LIST_ENTRY(network, false),
			LIST_ENTRY(wifi, false),
			LIST_ENTRY(power, true),
		})

	public:
	explicit Tray(QObject* parent = nullptr) : ConfigObject(parent) {}
};

class Bar : public ConfigObject {
	Q_OBJECT
	QML_ANONYMOUS

	CFG_PROPERTY(bool, autoHide, false)
	CFG_PROPERTY(int, border, 4)
	CFG_PROPERTY(bool, fullscreenReveal, true)
	CFG_PROPERTY(int, height, 24)
	CFG_PROPERTY(bool, hideWhenNotif, true)
	CONFIG_SUBOBJECT(Popouts, popouts)
	CFG_PROPERTY(int, revealDelay, 100)
	CFG_PROPERTY(int, rounding, 14)
	CFG_PROPERTY(int, smoothing, 32)
	CFG_PROPERTY(QString, position, QStringLiteral("top"))
	CONFIG_SUBOBJECT(Tray, tray)
	CONFIG_LIST(
		EntryList,
		entries,
		{
			LIST_ENTRY(workspaces, true),
			LIST_ENTRY(audio, true),
			LIST_ENTRY(media, true),
			LIST_ENTRY(resources, true),
			LIST_ENTRY(updates, true),
			LIST_ENTRY(dash, false),
			LIST_ENTRY(spacer, true),
			LIST_ENTRY(activeWindow, true),
			LIST_ENTRY(spacer, true),
			LIST_ENTRY(hyprsunset, true),
			LIST_ENTRY(tray, true),
			LIST_ENTRY(statusIcons, true),
			LIST_ENTRY(network, false),
			LIST_ENTRY(upower, true),
			LIST_ENTRY(clock, true),
			LIST_ENTRY(notifBell, true),
		})

	public:
	explicit Bar(QObject* parent = nullptr)
		: ConfigObject(parent)
		, m_popouts(new Popouts(this))
		, m_tray(new Tray(this)) {}
};

} // namespace ZShell::config
