#ifndef SBK_ITEMMONITORWRAPPER_H
#define SBK_ITEMMONITORWRAPPER_H

// Workaround to access protected functions
#ifndef protected
#  define protected public
#endif

#include <itemmonitor.h>

#include <sbkpython.h>

#include <array>
namespace Shiboken { struct AutoDecRef; class GilState; }

class ItemMonitorWrapper : public Akonadi::ItemMonitor
{
public:
    ItemMonitorWrapper();
    ItemMonitorWrapper(const ItemMonitorWrapper &) = delete;
    ItemMonitorWrapper& operator=(const ItemMonitorWrapper &) = delete;
    ItemMonitorWrapper(ItemMonitorWrapper &&) = delete;
    ItemMonitorWrapper& operator=(ItemMonitorWrapper &&) = delete;
    ~ItemMonitorWrapper() override;

    void itemChanged(const ::Akonadi::Item & item) override;
    static void sbk_o_itemChanged([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride, [[maybe_unused]] const ::Akonadi::Item & item);
    void itemRemoved() override;
    static void pysideInitQtMetaTypes();

    void resetPyMethodCache();

private:
    mutable std::array<PyObject *, 2> m_PyMethodCache = {nullptr, nullptr};
};

#endif // SBK_ITEMMONITORWRAPPER_H
