#ifndef SBK_INCIDENCEOBSERVERWRAPPER_H
#define SBK_INCIDENCEOBSERVERWRAPPER_H

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

#include <incidencebase.h>

#include <sbkpython.h>

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

class IncidenceObserverWrapper : public KCalendarCore::IncidenceBase::IncidenceObserver
{
public:
    IncidenceObserverWrapper();
    IncidenceObserverWrapper(const IncidenceObserverWrapper &) = delete;
    IncidenceObserverWrapper& operator=(const IncidenceObserverWrapper &) = delete;
    IncidenceObserverWrapper(IncidenceObserverWrapper &&) = delete;
    IncidenceObserverWrapper& operator=(IncidenceObserverWrapper &&) = delete;
    ~IncidenceObserverWrapper() override;

    void incidenceUpdate(const ::QString & uid, const ::QDateTime & recurrenceId) override;
    static void sbk_o_incidenceUpdate([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride, [[maybe_unused]] const ::QString & uid, [[maybe_unused]] const ::QDateTime & recurrenceId);
    void incidenceUpdated(const ::QString & uid, const ::QDateTime & recurrenceId) override;
    static void pysideInitQtMetaTypes();

    void resetPyMethodCache();

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

#endif // SBK_INCIDENCEOBSERVERWRAPPER_H
