#ifndef SBK_JOURNALWRAPPER_H
#define SBK_JOURNALWRAPPER_H

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

#include <journal.h>

#include <sbkpython.h>

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

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

    ::KCalendarCore::Journal * clone() const override;
    static ::KCalendarCore::Journal * sbk_o_clone([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride);
    void customPropertyUpdate() override;
    void customPropertyUpdated() override;
    ::QDateTime dateTime(::KCalendarCore::IncidenceBase::DateTimeRole role) const override;
    ::QDateTime dtStart() const override;
    ::QDateTime endDateForStart(const ::QDateTime & startDt) const override;
    bool equals(const ::KCalendarCore::IncidenceBase & journal) const override;
    ::QLatin1String iconName(const ::QDateTime & recurrenceId = {}) const override;
    ::QLatin1String mimeType() const override;
    ::QDateTime recurrenceId() const override;
    void recurrenceUpdated(::KCalendarCore::Recurrence * recurrence) override;
    bool recursOn(const ::QDate & date, const ::QTimeZone & timeZone) const override;
    void setAllDay(bool allDay) override;
    void setDateTime(const ::QDateTime & dateTime, ::KCalendarCore::IncidenceBase::DateTimeRole role) override;
    void setDtStart(const ::QDateTime & dt) override;
    void setDuration(const ::KCalendarCore::Duration & duration) override;
    void setLastModified(const ::QDateTime & lm) override;
    void setReadOnly(bool readonly) override;
    void shiftTimes(const ::QTimeZone & oldZone, const ::QTimeZone & newZone) override;
    ::QList<QDateTime> startDateTimesForDate(const ::QDate & date, const ::QTimeZone & timeZone) const override;
    ::QList<QDateTime> startDateTimesForDateTime(const ::QDateTime & datetime) const override;
    bool supportsGroupwareCommunication() const override;
    ::KCalendarCore::IncidenceBase::IncidenceType type() const override;
    ::QByteArray typeStr() const override;
    void virtual_hook(::KCalendarCore::IncidenceBase::VirtualHook id, void * data) override;
    static void pysideInitQtMetaTypes();

    void resetPyMethodCache();

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

#endif // SBK_JOURNALWRAPPER_H
