#pragma once

#pragma clang diagnostic ignored "-Winconsistent-missing-override"

#include <QAbstractItemModel>
#include <QPainter>
#include <QWidget>

class IProjectModel : public QAbstractItemModel
{
	Q_OBJECT
	Q_PROPERTY(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged)

public:
	using QAbstractItemModel::QAbstractItemModel;

	virtual ~IProjectModel() {}

	virtual bool dirty() const = 0;
	virtual void setDirty(bool dirty) = 0;

	virtual bool open(QString const &path) = 0;
	virtual bool save() const = 0;
	virtual bool saveAs(QString const &path) const = 0;

public slots:
	virtual void deselect() = 0;
	virtual void select(QModelIndex const &index) = 0;

signals:
	void dirtyChanged(bool dirty);
	void deselected();
	void selected(std::uint16_t index);
};

class IProjectView : public QWidget
{
	Q_OBJECT

public:
	using QWidget::QWidget;

	virtual ~IProjectView() {}

	virtual void drawView(void *paint) const = 0;

protected:
	void paintEvent(QPaintEvent *event) override
	{
		QPainter paint{this};
		paint.fillRect(QRectF(0, 0, width(), height()), QColor(0, 0, 0, 255));
		drawView(static_cast<void *>(&paint));
	}
};

// EOF
