#pragma once
#include <QQuickItem>

// EPScreenModeItem is a PRIVATE reMarkable type that lives in libqsgepaper.so
// (the epaper scenegraph backend). It is a QQuickItem that tags the screen region
// it covers with a panel refresh "mode" (Mono / FAST / FastGrayscale ...), which
// selects the e-ink waveform. xochitl wraps its writing area in one of these to
// get crisp, solid pen strokes instead of the default grayscale two-pass refresh.
//
// The SDK ships no header for it, so we declare a minimal interface matching the
// exported symbols (the constructor and the Q_OBJECT staticMetaObject) and link
// against the plugin. We drive its `mode` property via the runtime meta-object,
// so we never hardcode the Mode enum's integer values.
class EPScreenModeItem : public QQuickItem {
public:
    // Values confirmed at runtime from the real meta-object.
    enum Mode { Pen = 0, Mono = 1, Animation = 2, UI = 3, Content = 4, Sleep = 5 };

    explicit EPScreenModeItem(QQuickItem *parent = nullptr);

    // Exported by libqsgepaper (_ZN16EPScreenModeItem7setModeENS_4ModeE). The
    // `mode` property is read-only, so this is how you actually change it.
    void setMode(Mode m);
    Mode mode() const; // _ZNK16EPScreenModeItem4modeEv

    // Declared (defined in libqsgepaper.so, symbol exported) so this override is
    // the class "key function". That stops our TU from emitting a competing weak
    // vtable, so the loader uses libqsgepaper's real vtable — giving the real
    // metaObject (with the Mode enum) and real setMode().
    const QMetaObject *metaObject() const override;

    // Resolved at link time from libqsgepaper.so (_ZN16EPScreenModeItem16staticMetaObjectE).
    static const QMetaObject staticMetaObject;
};
