#ifndef SBK_RECURRENCEOBSERVERWRAPPER_H
#define SBK_RECURRENCEOBSERVERWRAPPER_H

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

#include <recurrence.h>

#include <sbkpython.h>

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

class RecurrenceObserverWrapper : public KCalendarCore::Recurrence::RecurrenceObserver
{
public:
    RecurrenceObserverWrapper();
    RecurrenceObserverWrapper(const RecurrenceObserverWrapper &) = delete;
    RecurrenceObserverWrapper& operator=(const RecurrenceObserverWrapper &) = delete;
    RecurrenceObserverWrapper(RecurrenceObserverWrapper &&) = delete;
    RecurrenceObserverWrapper& operator=(RecurrenceObserverWrapper &&) = delete;
    ~RecurrenceObserverWrapper() override;

    void recurrenceUpdated(::KCalendarCore::Recurrence * r) override;
    static void sbk_o_recurrenceUpdated([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride, [[maybe_unused]] ::KCalendarCore::Recurrence * r);
    static void pysideInitQtMetaTypes();

    void resetPyMethodCache();

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

#endif // SBK_RECURRENCEOBSERVERWRAPPER_H
