#ifndef SBK_TODOWRAPPER_H
#define SBK_TODOWRAPPER_H

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

#include <todo.h>

#include <sbkpython.h>

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

class TodoWrapper : public KCalendarCore::Todo
{
public:
    TodoWrapper();
    TodoWrapper(const ::KCalendarCore::Incidence & other);
    TodoWrapper(const TodoWrapper &) = delete;
    TodoWrapper(const KCalendarCore::Todo& self) : KCalendarCore::Todo(self)
    {
    }
    TodoWrapper& operator=(const TodoWrapper &) = delete;
    TodoWrapper(TodoWrapper &&) = delete;
    TodoWrapper& operator=(TodoWrapper &&) = delete;
    ~TodoWrapper() override;

    ::KCalendarCore::Todo * clone() const override;
    static ::KCalendarCore::Todo * 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;
    // Inherited overloads, because the using keyword sux
    ::QDateTime dtStart(bool first) const { return KCalendarCore::Todo::dtStart(first); }

    ::QDateTime endDateForStart(const ::QDateTime & startDt) const override;
    bool equals(const ::KCalendarCore::IncidenceBase & todo) 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_TODOWRAPPER_H
