#ifndef SBK_CUSTOMPROPERTIESWRAPPER_H
#define SBK_CUSTOMPROPERTIESWRAPPER_H

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

#include <customproperties.h>

#include <sbkpython.h>

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

class CustomPropertiesWrapper : public KCalendarCore::CustomProperties
{
public:
    CustomPropertiesWrapper();
    CustomPropertiesWrapper(const CustomPropertiesWrapper &) = delete;
    CustomPropertiesWrapper(const KCalendarCore::CustomProperties& self) : KCalendarCore::CustomProperties(self)
    {
    }
    CustomPropertiesWrapper& operator=(const CustomPropertiesWrapper &) = delete;
    CustomPropertiesWrapper(CustomPropertiesWrapper &&) = delete;
    CustomPropertiesWrapper& operator=(CustomPropertiesWrapper &&) = delete;
    ~CustomPropertiesWrapper() override;

    void customPropertyUpdate() override;
    static void sbk_o_customPropertyUpdate([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride);
    void customPropertyUpdated() override;
    static void pysideInitQtMetaTypes();

    void resetPyMethodCache();

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

#endif // SBK_CUSTOMPROPERTIESWRAPPER_H
