#ifndef SBK_MEMORYCALENDARWRAPPER_H
#define SBK_MEMORYCALENDARWRAPPER_H

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

#include <memorycalendar.h>

#include <sbkpython.h>

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

namespace PySide { class DynamicQMetaObject; }

class MemoryCalendarWrapper : public KCalendarCore::MemoryCalendar
{
public:
    MemoryCalendarWrapper(const ::QByteArray & timeZoneId);
    MemoryCalendarWrapper(const ::QTimeZone & timeZone);
    MemoryCalendarWrapper(const MemoryCalendarWrapper &) = delete;
    MemoryCalendarWrapper& operator=(const MemoryCalendarWrapper &) = delete;
    MemoryCalendarWrapper(MemoryCalendarWrapper &&) = delete;
    MemoryCalendarWrapper& operator=(MemoryCalendarWrapper &&) = delete;
    ~MemoryCalendarWrapper() override;

    void childEvent(::QChildEvent * event) override;
    void connectNotify(const ::QMetaMethod & signal) override;
    void customEvent(::QEvent * event) override;
    void customPropertyUpdate() override;
    void customPropertyUpdated() override;
    void disconnectNotify(const ::QMetaMethod & signal) override;
    void doSetTimeZone(const ::QTimeZone & timeZone) override;
    static void sbk_o_doSetTimeZone([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride, [[maybe_unused]] const ::QTimeZone & timeZone);
    void endBatchAdding() override;
    bool event(::QEvent * event) override;
    bool eventFilter(::QObject * watched, ::QEvent * event) override;
    void incidenceUpdate(const ::QString & uid, const ::QDateTime & recurrenceId) override;
    void incidenceUpdated(const ::QString & uid, const ::QDateTime & recurrenceId) override;
    void startBatchAdding() override;
    void timerEvent(::QTimerEvent * event) override;
    void virtual_hook(int id, void * data) override;
    static void sbk_o_virtual_hook([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride, [[maybe_unused]] int id, [[maybe_unused]] void * data);

    const ::QMetaObject * metaObject() const override;
    int qt_metacall(QMetaObject::Call call, int id, void **args) override;
    void *qt_metacast(const char *_clname) override;
    static void pysideInitQtMetaTypes();

    void resetPyMethodCache();

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

#endif // SBK_MEMORYCALENDARWRAPPER_H
